Package io.jmix.security.role.annotation
Annotation Interface ResourceRole
Indicates that annotated interface is a "Resource Role". Resource role is a container that holds resource policies.
Resource policies define permissions for any system resource: screen, entity read or create operation, entity attribute, etc.
Annotated interfaces are parsed by the AnnotatedResourceRoleProvider
and ResourceRole
objects are created using the information from the annotated interface.
Role definition example:
@ResourceRole(code = "orderView", name = "Order view") public interface OrderViewRole { @MenuPolicy(menuIds = {"application", "application-orders"}) @ScreenPolicy(screenIds = {"sample_Order.browse", "sample_Order.edit"}) @EntityPolicy(entityClass = Order.class, actions = {EntityPolicyAction.CREATE, EntityPolicyAction.READ}) @EntityAttributePolicy(entityClass = Order.class, attributes = {"number", "date"}, actions = {EntityAttributePolicyAction.UPDATE}) void order(); @ScreenPolicy(screenClasses = {CustomerBrowse.class, CustomerEdit.class}) @EntityPolicy(entityClass = Customer.class, actions = {EntityPolicyAction.ALL}) @EntityAttributePolicy(entityClass = Customer.class, attributes = {"*"}, actions = {EntityAttributePolicyAction.UPDATE}) void customer(); }
Role interface may have any number of methods. Methods can have any names, methods are used only to group policies logically. Policies may be grouped by entity they relate (as in the example above) or by type (one method will have annotations for screen policies, another one for entity policies, etc.).
Method return type matters only for methods with ExplicitResourcePolicies
annotations.
-
Required Element Summary
-
Optional Element Summary