Class SecurityManagementUtils


  • public class SecurityManagementUtils
    extends Object

    User system management helper class shared between backend and client side of the application.

    Since:
    0.8.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static org.uberfire.ext.security.management.api.Capability[] GROUPS_CAPABILITIES  
      static org.uberfire.ext.security.management.api.Capability[] ROLES_CAPABILITIES  
      static org.uberfire.ext.security.management.api.Capability[] USERS_CAPABILITIES  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.jboss.errai.security.shared.api.identity.User clone​(org.jboss.errai.security.shared.api.identity.User user)  
      static org.jboss.errai.security.shared.api.Group createGroup​(String name)  
      static org.jboss.errai.security.shared.api.Role createRole​(String name)  
      static org.jboss.errai.security.shared.api.identity.User createUser​(String id)  
      static org.jboss.errai.security.shared.api.identity.User createUser​(String id, Set<org.jboss.errai.security.shared.api.Group> groups)  
      static org.jboss.errai.security.shared.api.identity.User createUser​(String id, Set<org.jboss.errai.security.shared.api.Group> groups, Set<org.jboss.errai.security.shared.api.Role> roles)  
      static org.jboss.errai.security.shared.api.identity.User createUser​(String id, Set<org.jboss.errai.security.shared.api.Group> groups, Set<org.jboss.errai.security.shared.api.Role> roles, Map<String,​String> properties)  
      static Set<org.jboss.errai.security.shared.api.Group> getGroups​(org.uberfire.ext.security.management.api.UserSystemManager userSystemManager, String username)  
      static Set<String> getRegisteredRoleNames()  
      static Set<org.jboss.errai.security.shared.api.Role> getRegisteredRoles()  
      static Set<org.jboss.errai.security.shared.api.Role> getRoles​(org.uberfire.ext.security.management.api.UserSystemManager userSystemManager, String username)  
      static Set<String> groupsToString​(Set<org.jboss.errai.security.shared.api.Group> groups)  
      static void populateGroupOrRoles​(String name, Set<String> registeredRoles, Set<org.jboss.errai.security.shared.api.Group> groups, Set<org.jboss.errai.security.shared.api.Role> roles)
      Utility method that check if the given group or role name is in the list of registeredRoles, if it is, it adds the Role for the given name in the given roles set argument, otherwise, into the list.
      static Set<String> rolesToString​(Set<org.jboss.errai.security.shared.api.Role> roles)  
    • Field Detail

      • USERS_CAPABILITIES

        public static final org.uberfire.ext.security.management.api.Capability[] USERS_CAPABILITIES
      • GROUPS_CAPABILITIES

        public static final org.uberfire.ext.security.management.api.Capability[] GROUPS_CAPABILITIES
      • ROLES_CAPABILITIES

        public static final org.uberfire.ext.security.management.api.Capability[] ROLES_CAPABILITIES
    • Constructor Detail

      • SecurityManagementUtils

        public SecurityManagementUtils()
    • Method Detail

      • createUser

        public static org.jboss.errai.security.shared.api.identity.User createUser​(String id)
      • createUser

        public static org.jboss.errai.security.shared.api.identity.User createUser​(String id,
                                                                                   Set<org.jboss.errai.security.shared.api.Group> groups)
      • createUser

        public static org.jboss.errai.security.shared.api.identity.User createUser​(String id,
                                                                                   Set<org.jboss.errai.security.shared.api.Group> groups,
                                                                                   Set<org.jboss.errai.security.shared.api.Role> roles)
      • createUser

        public static org.jboss.errai.security.shared.api.identity.User createUser​(String id,
                                                                                   Set<org.jboss.errai.security.shared.api.Group> groups,
                                                                                   Set<org.jboss.errai.security.shared.api.Role> roles,
                                                                                   Map<String,​String> properties)
      • createGroup

        public static org.jboss.errai.security.shared.api.Group createGroup​(String name)
      • createRole

        public static org.jboss.errai.security.shared.api.Role createRole​(String name)
      • clone

        public static org.jboss.errai.security.shared.api.identity.User clone​(org.jboss.errai.security.shared.api.identity.User user)
      • getGroups

        public static Set<org.jboss.errai.security.shared.api.Group> getGroups​(org.uberfire.ext.security.management.api.UserSystemManager userSystemManager,
                                                                               String username)
      • getRoles

        public static Set<org.jboss.errai.security.shared.api.Role> getRoles​(org.uberfire.ext.security.management.api.UserSystemManager userSystemManager,
                                                                             String username)
      • getRegisteredRoles

        public static Set<org.jboss.errai.security.shared.api.Role> getRegisteredRoles()
      • getRegisteredRoleNames

        public static Set<String> getRegisteredRoleNames()
      • populateGroupOrRoles

        public static void populateGroupOrRoles​(String name,
                                                Set<String> registeredRoles,
                                                Set<org.jboss.errai.security.shared.api.Group> groups,
                                                Set<org.jboss.errai.security.shared.api.Role> roles)
        Utility method that check if the given group or role name is in the list of registeredRoles, if it is, it adds the Role for the given name in the given roles set argument, otherwise, into the list. This method it's just a shortcut to avoid code duplipcation on several points.
      • rolesToString

        public static Set<String> rolesToString​(Set<org.jboss.errai.security.shared.api.Role> roles)
      • groupsToString

        public static Set<String> groupsToString​(Set<org.jboss.errai.security.shared.api.Group> groups)