Class AnnotatedRoleBuilderImpl

java.lang.Object
io.jmix.security.impl.role.builder.AnnotatedRoleBuilderImpl
All Implemented Interfaces:
AnnotatedRoleBuilder

@NullMarked @Component("sec_AnnotatedRoleBuilder") public class AnnotatedRoleBuilderImpl extends Object implements AnnotatedRoleBuilder
  • Field Details

  • Constructor Details

  • Method Details

    • createResourceRole

      public ResourceRole createResourceRole(String className)
      Specified by:
      createResourceRole in interface AnnotatedRoleBuilder
    • createRowLevelRole

      public RowLevelRole createRowLevelRole(String className)
      Specified by:
      createRowLevelRole in interface AnnotatedRoleBuilder
    • loadClass

      protected Class<?> loadClass(String className)
    • initBaseParameters

      protected void initBaseParameters(BaseRole role, Class<?> roleClass, String name, String code, String description)
      Sets the base parameters of a role. A name or a description declared as a msg:// reference gets the message in the default locale, and the role keeps the key of the message.
    • initBaseParameters

      protected void initBaseParameters(BaseRole role, String name, String code, String description)
    • getDefaultName

      protected String getDefaultName(String messageKey)
      Returns:
      the message of the key in the default locale, or the key if the message is missing or blank, so that the role never goes without a name
    • getDefaultDescription

      protected String getDefaultDescription(String messageKey)
      Returns:
      the message of the key in the default locale, or the key if the message is missing
    • extractMessageKey

      protected String extractMessageKey(String reference, Class<?> roleClass)
      Extracts the key of the message a msg:// reference points to. The reference takes one of the three forms a view descriptor accepts: msg://key belongs to the package of the role class, msg://group/key keeps its group and msg:///key belongs to the main message group. Any other reference with a slash in it, such as msg://a/b/c, is taken as it is: what follows msg:// becomes the key.
    • extractChildRoles

      protected <A extends Annotation> Set<String> extractChildRoles(Class<?> roleClass, Class<A> annotationClass, Function<A,String> codeExtractor)
      Returns the codes of the roles that the role interface extends. A role is a parent interface with the same role annotation, found directly or through parent interfaces without that annotation. The policies of these roles are already among the policies of the role, because they are extracted from all methods of the role interface.
    • extractResourcePolicies

      protected Collection<ResourcePolicy> extractResourcePolicies(Class<?> roleClass)
    • extractRowLevelPolicies

      protected Collection<RowLevelPolicy> extractRowLevelPolicies(Class<?> roleClass)