mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-04 03:10:50 +01:00
Introduce namespace permissions
This commit is contained in:
@@ -24,16 +24,29 @@
|
||||
|
||||
package sonia.scm.repository;
|
||||
|
||||
import com.github.sdorra.ssp.PermissionObject;
|
||||
import com.github.sdorra.ssp.StaticPermissions;
|
||||
import org.apache.commons.lang.builder.EqualsBuilder;
|
||||
import org.apache.commons.lang.builder.HashCodeBuilder;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static java.util.Collections.unmodifiableCollection;
|
||||
|
||||
public class Namespace implements Cloneable {
|
||||
@StaticPermissions(
|
||||
value = "namespace",
|
||||
globalPermissions = {"permissionRead", "permissionWrite"},
|
||||
permissions = {},
|
||||
custom = true, customGlobal = true
|
||||
)
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "namespaces")
|
||||
public class Namespace implements PermissionObject, Cloneable {
|
||||
|
||||
private String namespace;
|
||||
private Set<RepositoryPermission> permissions = new HashSet<>();
|
||||
@@ -69,6 +82,11 @@ public class Namespace implements Cloneable {
|
||||
return this.permissions.remove(permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return getNamespace();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
||||
@@ -44,6 +44,12 @@
|
||||
<permission>
|
||||
<value>repository:create</value>
|
||||
</permission>
|
||||
<permission>
|
||||
<value>namespace:permissionRead</value>
|
||||
</permission>
|
||||
<permission>
|
||||
<value>namespace:permissionWrite</value>
|
||||
</permission>
|
||||
<permission>
|
||||
<value>user:*</value>
|
||||
</permission>
|
||||
|
||||
@@ -93,6 +93,16 @@
|
||||
"description": "Darf alle installierten und verfügbaren Plugins lesen und verwalten"
|
||||
}
|
||||
},
|
||||
"namespace": {
|
||||
"permissionRead": {
|
||||
"displayName": "Berechtigungen auf Namespaces lesen",
|
||||
"description": "Darf die Berechtigungen auf Namespace-Ebene sehen"
|
||||
},
|
||||
"permissionWrite": {
|
||||
"displayName": "Berechtigungen auf Namespaces modifizieren",
|
||||
"description": "Darf die Berechtigungen auf Namespace-Ebene bearbeiten"
|
||||
}
|
||||
},
|
||||
"unknown": "Unbekannte Berechtigung"
|
||||
},
|
||||
"verbs": {
|
||||
|
||||
@@ -93,6 +93,16 @@
|
||||
"description": "May see and manage all installed and available plugins"
|
||||
}
|
||||
},
|
||||
"namespace": {
|
||||
"permissionRead": {
|
||||
"displayName": "read permissions on namespaces",
|
||||
"description": "May see the permissions set for namespaces"
|
||||
},
|
||||
"permissionWrite": {
|
||||
"displayName": "modify permissions on namespaces",
|
||||
"description": "May modify the permissions set for namespaces"
|
||||
}
|
||||
},
|
||||
"unknown": "Unknown permission"
|
||||
},
|
||||
"verbs": {
|
||||
|
||||
Reference in New Issue
Block a user