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 Summary
FieldsModifier and TypeFieldDescriptionprotected Messagesprotected MessageSourceConfigurationprotected MessageTools -
Constructor Summary
ConstructorsConstructorDescriptionAnnotatedRoleBuilderImpl(Collection<ResourcePolicyExtractor> resourcePolicyExtractors, Collection<RowLevelPolicyExtractor> rowLevelPolicyExtractors, ClassManager classManager) -
Method Summary
Modifier and TypeMethodDescriptioncreateResourceRole(String className) createRowLevelRole(String className) 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.protected StringextractMessageKey(String reference, Class<?> roleClass) Extracts the key of the message amsg://reference points to.protected Collection<ResourcePolicy> extractResourcePolicies(Class<?> roleClass) protected Collection<RowLevelPolicy> extractRowLevelPolicies(Class<?> roleClass) protected StringgetDefaultDescription(String messageKey) protected StringgetDefaultName(String messageKey) protected voidSets the base parameters of a role.protected voidinitBaseParameters(BaseRole role, String name, String code, String description) protected Class<?>
-
Field Details
-
messages
-
messageTools
-
messageSourceConfiguration
-
-
Constructor Details
-
AnnotatedRoleBuilderImpl
@Autowired public AnnotatedRoleBuilderImpl(Collection<ResourcePolicyExtractor> resourcePolicyExtractors, Collection<RowLevelPolicyExtractor> rowLevelPolicyExtractors, ClassManager classManager)
-
-
Method Details
-
createResourceRole
- Specified by:
createResourceRolein interfaceAnnotatedRoleBuilder
-
createRowLevelRole
- Specified by:
createRowLevelRolein interfaceAnnotatedRoleBuilder
-
loadClass
-
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 amsg://reference gets the message in the default locale, and the role keeps the key of the message. -
initBaseParameters
-
getDefaultName
- 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
- Returns:
- the message of the key in the default locale, or the key if the message is missing
-
extractMessageKey
Extracts the key of the message amsg://reference points to. The reference takes one of the three forms a view descriptor accepts:msg://keybelongs to the package of the role class,msg://group/keykeeps its group andmsg:///keybelongs to the main message group. Any other reference with a slash in it, such asmsg://a/b/c, is taken as it is: what followsmsg://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
-
extractRowLevelPolicies
-