Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

change plugin permission "manage" to "write" #11

Merged
merged 2 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Tooltip for favoring repositories ([#10](https://github.com/scm-manager/scm-landingpage-plugin/pull/10))

### Fixed
- Change plugin permission "manage" to "write" ([#11](https://github.com/scm-manager/scm-landingpage-plugin/pull/11))

## [1.0.0-rc1] - 2020-04-14

Initial release
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.time.Instant;

@Extension
@EagerSingleton
Expand All @@ -54,7 +53,7 @@ public PluginInstallationFailedEventSubscriber(MyEventStore store) {
public void handleEvent(PluginEvent pluginEvent) {
if (pluginEvent.getEventType() == PluginEvent.PluginEventType.INSTALLATION_FAILED) {
AvailablePlugin newPlugin = pluginEvent.getPlugin();
String permission = PluginPermissions.manage().asShiroString();
String permission = PluginPermissions.write().asShiroString();
String pluginName = newPlugin.getDescriptor().getInformation().getDisplayName();
String pluginVersion = newPlugin.getDescriptor().getInformation().getVersion();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.time.Instant;
import java.util.Optional;

@Extension
Expand All @@ -60,7 +59,7 @@ public void handleEvent(PluginEvent pluginEvent) {
if (pluginEvent.getEventType() == PluginEvent.PluginEventType.INSTALLED) {
AvailablePlugin newPlugin = pluginEvent.getPlugin();
Optional<InstalledPlugin> installedPlugin = pluginManager.getInstalled(newPlugin.getDescriptor().getInformation().getName());
String permission = PluginPermissions.manage().asShiroString();
String permission = PluginPermissions.write().asShiroString();
String pluginName = newPlugin.getDescriptor().getInformation().getDisplayName();
String previousPluginVersion = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public PluginTaskProvider(PluginManager pluginManager) {
@Override
public Iterable<MyTask> getTasks() {
List<PluginUpdateTask> tasks = new ArrayList<>();
if (PluginPermissions.manage().isPermitted()) {
if (PluginPermissions.write().isPermitted()) {
List<InstalledPlugin> updatable = pluginManager.getUpdatable();
int size = updatable.size();
if (size > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ void shouldFireMyEvent() {

PluginInstallationFailedEventSubscriber.PluginInstallationFailedEvent pluginInstalledEvent = eventCaptor.getValue();
assertThat(pluginInstalledEvent.getType()).isEqualTo("PluginInstallationFailedEvent");
assertThat(pluginInstalledEvent.getPermission()).isEqualTo("plugin:manage");
assertThat(pluginInstalledEvent.getPermission()).isEqualTo("plugin:write");
assertThat(pluginInstalledEvent.getPluginVersion()).isEqualTo("1.0");
assertThat(pluginInstalledEvent.getPluginName()).isEqualTo(newPlugin.getDescriptor().getInformation().getDisplayName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void shouldFireMyEvent() {

PluginInstalledEventSubscriber.PluginInstalledEvent pluginInstalledEvent = eventCaptor.getValue();
assertThat(pluginInstalledEvent.getType()).isEqualTo("PluginInstalledEvent");
assertThat(pluginInstalledEvent.getPermission()).isEqualTo("plugin:manage");
assertThat(pluginInstalledEvent.getPermission()).isEqualTo("plugin:write");
assertThat(pluginInstalledEvent.getPreviousPluginVersion()).isEqualTo("1.0");
assertThat(pluginInstalledEvent.getNewPluginVersion()).isEqualTo("1.1");
assertThat(pluginInstalledEvent.getPluginName()).isEqualTo(newPlugin.getDescriptor().getInformation().getDisplayName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Priviledged {

@BeforeEach
void assignPermissions() {
when(subject.isPermitted(PluginPermissions.manage().asShiroString())).thenReturn(true);
when(subject.isPermitted(PluginPermissions.write().asShiroString())).thenReturn(true);
}

@Test
Expand Down