public interface PermissionManagementService
This service does not provide permissions checking operations; use PermissionCheckingService for that.
However, permission management operations provided here can be used to build custom permission-checking logic if the
PermissionCheckingService does not provide required functionality.
Permission is a single object representing an abstract "user right", uniquely identified by name. Permission assignment is a relationship between permission, principal and some object that exists within the platform.
Conceptually permission assignment is defined by a tuple: PA=(Object, Principal, Name, Value), where:
There is a restriction over possible tuple values: It is not possible to define two permission assignments that refer to the same Object, Principal and Name, but have different Value e.g. PA1(O1,P1,N1,GRANTED) and PA2(O1,P1,N1,DENIED). When using this service to define such assignments, only one of them will be actually stored in the system (previously defined assignment will be overwritten).
This service allows to manage permission assignments defined by possible values of the tuple PA (as defined above), that is:
Permission assignments to objects such as items, types and attributes allow to express arbitrary constraints on user access to these objects. One can for example define permissions that allow/forbid certain users to read items of specific type, or to restrict reading to only some attributes of the type, and so on.
Global permission assignments are special in that they do not refer to any specific platform object, they just define a relation between a permission and a principal. This can be useful to express constraints that are not related with any item/type/attribute. For example one might introduce "platform_initialization" permission, that enables a user to perform platform initialisation. Such a permission is not related to any specific item or type, so it's best modelled as global permission assignment. Global permission assignment can also be used to provide fall-back permission values when implementing complex permission checking scheme (e.g. "when no assignment has been found on an object, check global assignments").
Permissions and permission assignments defined and managed by this service are not automatically enforced in other core platform services, unless explicitly indicated in the service API. This generally means that the permissions will be "effective" only if some piece of client code performs explicit permission checking.
PermissionCheckingService instead.| Modifier and Type | Method and Description |
|---|---|
void |
addAttributePermission(AttributeDescriptorModel attribute,
PermissionAssignment... permissionAssignment)
Adds a permission assignment(s) to an attribute descriptor.
|
void |
addAttributePermissions(AttributeDescriptorModel attribute,
java.util.Collection<PermissionAssignment> permissionAssignments)
Adds all permission assignments defined in given collection to an attribute descriptor.
|
void |
addGlobalPermission(PermissionAssignment... permissionAssignment)
Adds new global permission assignments.
|
void |
addGlobalPermissions(java.util.Collection<PermissionAssignment> permissionAssignments)
Globally adds all permission assignments defined in given collection.
|
void |
addItemPermission(ItemModel item,
PermissionAssignment... permissionAssignment)
Adds a permission assignment(s) to an item.
|
void |
addItemPermissions(ItemModel item,
java.util.Collection<PermissionAssignment> permissionAssignments)
Adds all permission assignments defined in given collection to an item.
|
void |
addTypePermission(ComposedTypeModel type,
PermissionAssignment... permissionAssignment)
Adds a permission assignment(s) to a type.
|
void |
addTypePermissions(ComposedTypeModel type,
java.util.Collection<PermissionAssignment> permissionAssignments)
Adds all permission assignments defined in given collection to a type.
|
void |
clearAttributePermissions(AttributeDescriptorModel attribute)
Remove all permission assignments from a given attribute descriptor.
|
void |
clearItemPermissions(ItemModel item)
Remove all permission assignments from a given item.
|
void |
clearTypePermissions(ComposedTypeModel type)
Remove all permission assignments from a given type.
|
void |
createPermission(java.lang.String permissionName)
Creates a new permission with a given name.
|
java.util.Collection<PermissionAssignment> |
getAttributePermissions(AttributeDescriptorModel attribute)
Returns a collection representing all permission assigned to given attribute.
|
java.util.Collection<PermissionAssignment> |
getAttributePermissionsForName(AttributeDescriptorModel attribute,
java.lang.String... permissionName)
Returns a collection representing permissions with specified name(s) assigned to given attribute.
|
java.util.Collection<PermissionAssignment> |
getAttributePermissionsForPrincipal(AttributeDescriptorModel attribute,
PrincipalModel... principal)
Returns a collection representing permissions assigned to given attribute for specified principal(s).
|
java.util.Collection<java.lang.String> |
getDefinedPermissions()
Returns a collection of names of all defined permissions.
|
java.util.Collection<PermissionAssignment> |
getGlobalPermissionsForName(java.lang.String... permissionName)
Deprecated.
since 6.0.0 - this method is for remove in future version
|
java.util.Collection<PermissionAssignment> |
getGlobalPermissionsForPrincipal(PrincipalModel... principal)
Returns a collection representing all global permission assignments for specified principal(s).
|
java.util.Collection<PermissionAssignment> |
getItemPermissions(ItemModel item)
Returns a collection representing all permission assigned to given item.
|
java.util.Collection<PermissionAssignment> |
getItemPermissionsForName(ItemModel item,
java.lang.String... permissionName)
Returns a collection representing permissions with specified name(s) assigned to given item.
|
java.util.Collection<PermissionAssignment> |
getItemPermissionsForPrincipal(ItemModel item,
PrincipalModel... principal)
Returns a collection representing permissions assigned to given item for specified principal(s).
|
java.util.Collection<PermissionAssignment> |
getTypePermissions(ComposedTypeModel type)
Returns a collection representing all permission assigned to given type.
|
java.util.Collection<PermissionAssignment> |
getTypePermissionsForName(ComposedTypeModel type,
java.lang.String... permissionName)
Returns a collection representing permissions with specified name(s) assigned to given type.
|
java.util.Collection<PermissionAssignment> |
getTypePermissionsForPrincipal(ComposedTypeModel type,
PrincipalModel... principal)
Returns a collection representing permissions assigned to given type for specified principal(s).
|
void |
removeAttributePermission(AttributeDescriptorModel attribute,
PermissionAssignment... permissionAssignment)
Removes permission assignments from an attribute descriptor.
|
void |
removeAttributePermissions(AttributeDescriptorModel attribute,
java.util.Collection<PermissionAssignment> permissionAssignments)
Removes permission assignments from an item.
|
void |
removeAttributePermissionsForName(AttributeDescriptorModel attribute,
java.lang.String... permissionName)
Removes all permission assignments from an attribute descriptor that refer to given permission name(s).
|
void |
removeAttributePermissionsForPrincipal(AttributeDescriptorModel attribute,
PrincipalModel... principal)
Removes all permission assignments from an attribute descriptor that refer to given principal(s).
|
void |
removeGlobalPermission(PermissionAssignment... permissionAssignment)
Removes global permission assignment(s).
|
void |
removeGlobalPermissions(java.util.Collection<PermissionAssignment> permissionAssignments)
Removes global permission assignments.
|
void |
removeGlobalPermissionsForName(java.lang.String... permissionName)
Removes all global permission assignments that refer to given permission name(s).
|
void |
removeGlobalPermissionsForPrincipal(PrincipalModel... principal)
Removes all global permission assignments that refer to given principal(s).
|
void |
removeItemPermission(ItemModel item,
PermissionAssignment... permissionAssignment)
Removes permission assignments from an item.
|
void |
removeItemPermissions(ItemModel item,
java.util.Collection<PermissionAssignment> permissionAssignments)
Removes permission assignments from an item.
|
void |
removeItemPermissionsForName(ItemModel item,
java.lang.String... permissionName)
Removes all permission assignments from an item that refer to given permission name(s).
|
void |
removeItemPermissionsForPrincipal(ItemModel item,
PrincipalModel... principal)
Removes all permission assignments from an item that refer to given principal(s).
|
void |
removeTypePermission(ComposedTypeModel type,
PermissionAssignment... permissionAssignment)
Removes permission assignments from a type.
|
void |
removeTypePermissions(ComposedTypeModel type,
java.util.Collection<PermissionAssignment> permissionAssignments)
Removes permission assignments from a type.
|
void |
removeTypePermissionsForName(ComposedTypeModel type,
java.lang.String... permissionName)
Removes all permission assignments from a type that refer to given permission name(s).
|
void |
removeTypePermissionsForPrincipal(ComposedTypeModel type,
PrincipalModel... principal)
Removes all permission assignments from a type that refer to given principal(s).
|
void |
setAttributePermissions(AttributeDescriptorModel attribute,
java.util.Collection<PermissionAssignment> permissionAssignments)
Replaces permission assignments to an attribute descriptor with the ones in given collection.
|
void |
setItemPermissions(ItemModel item,
java.util.Collection<PermissionAssignment> permissionAssignments)
Replaces permission assignments to an item with the ones in given collection.
|
void |
setTypePermissions(ComposedTypeModel type,
java.util.Collection<PermissionAssignment> permissionAssignments)
Replaces existing permission assignments to a type with the ones in given collection.
|
void createPermission(java.lang.String permissionName)
permissionName - name for permission.ModelSavingException - when a permission with given name already exists.java.util.Collection<java.lang.String> getDefinedPermissions()
java.util.Collection<PermissionAssignment> getItemPermissions(ItemModel item)
java.util.Collection<PermissionAssignment> getItemPermissionsForPrincipal(ItemModel item, PrincipalModel... principal)
java.util.Collection<PermissionAssignment> getItemPermissionsForName(ItemModel item, java.lang.String... permissionName)
void addItemPermission(ItemModel item, PermissionAssignment... permissionAssignment)
Corner case: This method will overwrite existing permission assignment if it involves the same item, principal and permission, but with opposite value of "isGranted" flag. In other words a permission to an item cannot be assigned twice: as "granted" and as "denied" for the same principal.
void addItemPermissions(ItemModel item, java.util.Collection<PermissionAssignment> permissionAssignments)
addItemPermission(ItemModel, PermissionAssignment...)).void setItemPermissions(ItemModel item, java.util.Collection<PermissionAssignment> permissionAssignments)
void removeItemPermission(ItemModel item, PermissionAssignment... permissionAssignment)
void removeItemPermissions(ItemModel item, java.util.Collection<PermissionAssignment> permissionAssignments)
removeItemPermission(ItemModel, PermissionAssignment...)void removeItemPermissionsForPrincipal(ItemModel item, PrincipalModel... principal)
void removeItemPermissionsForName(ItemModel item, java.lang.String... permissionName)
void clearItemPermissions(ItemModel item)
java.util.Collection<PermissionAssignment> getTypePermissions(ComposedTypeModel type)
java.util.Collection<PermissionAssignment> getTypePermissionsForPrincipal(ComposedTypeModel type, PrincipalModel... principal)
java.util.Collection<PermissionAssignment> getTypePermissionsForName(ComposedTypeModel type, java.lang.String... permissionName)
void addTypePermission(ComposedTypeModel type, PermissionAssignment... permissionAssignment)
Corner case: This method will overwrite existing permission assignment if it involves the same type, principal and permission, but with opposite value of "isGranted" flag. In other words a permission to a type cannot be assigned twice: as "granted" and as "denied" for the same principal.
void addTypePermissions(ComposedTypeModel type, java.util.Collection<PermissionAssignment> permissionAssignments)
addTypePermission(ComposedTypeModel, PermissionAssignment...)).void setTypePermissions(ComposedTypeModel type, java.util.Collection<PermissionAssignment> permissionAssignments)
void removeTypePermission(ComposedTypeModel type, PermissionAssignment... permissionAssignment)
void removeTypePermissions(ComposedTypeModel type, java.util.Collection<PermissionAssignment> permissionAssignments)
removeTypePermission(ComposedTypeModel, PermissionAssignment...)void removeTypePermissionsForPrincipal(ComposedTypeModel type, PrincipalModel... principal)
void removeTypePermissionsForName(ComposedTypeModel type, java.lang.String... permissionName)
void clearTypePermissions(ComposedTypeModel type)
java.util.Collection<PermissionAssignment> getAttributePermissions(AttributeDescriptorModel attribute)
java.util.Collection<PermissionAssignment> getAttributePermissionsForPrincipal(AttributeDescriptorModel attribute, PrincipalModel... principal)
java.util.Collection<PermissionAssignment> getAttributePermissionsForName(AttributeDescriptorModel attribute, java.lang.String... permissionName)
void addAttributePermission(AttributeDescriptorModel attribute, PermissionAssignment... permissionAssignment)
Corner case: This method will overwrite existing permission assignment if it involves the same attribute, principal and permission, but with opposite value of "isGranted" flag. In other words a permission to an attribute cannot be assigned twice: as "granted" and as "denied" for the same principal.
void addAttributePermissions(AttributeDescriptorModel attribute, java.util.Collection<PermissionAssignment> permissionAssignments)
addAttributePermission(AttributeDescriptorModel, PermissionAssignment...)).void setAttributePermissions(AttributeDescriptorModel attribute, java.util.Collection<PermissionAssignment> permissionAssignments)
void removeAttributePermission(AttributeDescriptorModel attribute, PermissionAssignment... permissionAssignment)
void removeAttributePermissions(AttributeDescriptorModel attribute, java.util.Collection<PermissionAssignment> permissionAssignments)
removeAttributePermission(AttributeDescriptorModel, PermissionAssignment...)void removeAttributePermissionsForPrincipal(AttributeDescriptorModel attribute, PrincipalModel... principal)
void removeAttributePermissionsForName(AttributeDescriptorModel attribute, java.lang.String... permissionName)
void clearAttributePermissions(AttributeDescriptorModel attribute)
java.util.Collection<PermissionAssignment> getGlobalPermissionsForPrincipal(PrincipalModel... principal)
@Deprecated java.util.Collection<PermissionAssignment> getGlobalPermissionsForName(java.lang.String... permissionName)
void addGlobalPermission(PermissionAssignment... permissionAssignment)
Corner case: This method will overwrite existing permission assignment if it involves the same principal and permission, but with opposite value of "isGranted" flag. In other words a permission cannot be globally assigned twice: as "granted" and as "denied" for the same principal.
void addGlobalPermissions(java.util.Collection<PermissionAssignment> permissionAssignments)
addGlobalPermission(PermissionAssignment...)).void removeGlobalPermission(PermissionAssignment... permissionAssignment)
void removeGlobalPermissions(java.util.Collection<PermissionAssignment> permissionAssignments)
removeGlobalPermission(PermissionAssignment...)void removeGlobalPermissionsForPrincipal(PrincipalModel... principal)
void removeGlobalPermissionsForName(java.lang.String... permissionName)
Copyright © 2018 SAP SE. All Rights Reserved.