Class ProfileAssignmentsToolClientSideElement

All Implemented Interfaces:
ClientSideElement, LogEnabled, PluginAware, Configurable, Serviceable
Direct Known Subclasses:
CartProfileAssignmentsToolClientSideElement, ExtractionProfileAssignmentsToolClientSideElement, QueriesProfileAssignmentsToolClientSideElement

ClientSideElement for the tool displaying the profile assignments
  • Field Details

  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager smanager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Overrides:
      service in class StaticFileImportsClientSideElement
      Throws:
      ServiceException
    • configure

      public void configure(Configuration configuration) throws ConfigurationException
      Specified by:
      configure in interface Configurable
      Overrides:
      configure in class StaticFileImportsClientSideElement
      Throws:
      ConfigurationException
    • _configureRightContextIds

      protected void _configureRightContextIds(Configuration configuration) throws ConfigurationException
      Configure the restricted right context ids
      Parameters:
      configuration - the global configuration
      Throws:
      ConfigurationException - The configuration is incorrect
    • getRightAssignmentContexts

      Get the right assignments contexts handled by this tool
      Returns:
      the right assignments contexts
    • getScripts

      public List<ClientSideElement.Script> getScripts(boolean ignoreRights, Map<String,Object> contextParameters)
      Description copied from interface: ClientSideElement
      This method return the scripts that will be used on client side. This class will be parametrized by initial and current parameters.
      Specified by:
      getScripts in interface ClientSideElement
      Overrides:
      getScripts in class StaticFileImportsClientSideElement
      Parameters:
      ignoreRights - True to ignore the rights verification.
      contextParameters - Contextuals parameters transmitted by the environment.
      Returns:
      The list of scripts or an empty list.
    • getUserGroups

      public List<Map<String,Object>> getUserGroups(String login, String populationId)
      Gets the groups of a user as JSON
      Parameters:
      login - The login of the user
      populationId - The population of the user
      Returns:
      the groups of a user as JSON
    • saveChanges

      public Map<String,Object> saveChanges(String rightAssignmentCtxId, Object jsContext, List<Map<String,Object>> assignmentsInfo)
      Save some changes made client-side.
      Parameters:
      rightAssignmentCtxId - The id of the right assignment context
      jsContext - The JS object context
      assignmentsInfo - The list of all the changes to make. Each map in the list must contain the following keys:
      1. profileId for the id of the profile (as a string)
      2. assignment for the kind of assignment (can be ACCESS_TYPE_ALLOW, ACCESS_TYPE_DENY...)
      3. assignmentType expects one of these four strings: "user", "group", "anonymous", "anyConnectedUser"
      4. identity Can be null if assignmentType is "anonymous" or "anyConnectedUser". If "user", must be a map with the keys "login" and "populationId". If "group", must be a map with the keys "groupId" and "groupDirectory"
      Returns:
      a map containing 3 objects : success : boolean, everything is saved successInfos : elements from assignmentsInfo that are saved errorInfos : elements from assignmentsInfo that are not saved
    • hasRight

      protected boolean hasRight(Map<String,String> rights, Object context)
      Determine following the right parameter if the user has right to access this feature
      Parameters:
      rights - The rights (name, context) to check. Can be empty.
      context - The object context
      Returns:
      true if the user has the right or if there is not right and false otherwise
    • _checkRightAssignmentContext

      protected boolean _checkRightAssignmentContext(String rightAssignmentCtxId)
      Returns true if right assignment context is part of handled right assignment contexts
      Parameters:
      rightAssignmentCtxId - the id of right assignment context
      Returns:
      true if it right assignment context is allowed
    • canDelegateRights

      protected boolean canDelegateRights(UserIdentity user, Set<GroupIdentity> groups, String profileId, String assignment, Object context)
      Only allow user with right CMS_Rights_Delegate_Rights to add a profil that this user already have on this context
      Parameters:
      user - user that want to de an assignment
      groups - groups of the user
      profileId - profil impacted
      assignment - assignment see ProfileAssignmentsToolClientSideElement.AccessType
      context - context of the assignment
      Returns:
      true if user can de this assignment
    • _notifyObservers

      protected void _notifyObservers(Object context, String contextIdentifier, Set<String> profileIds)
      Notify observers after modifying profile assignments.
      Parameters:
      context - The context
      contextIdentifier - The context identifier
      profileIds - The profiles
    • _getEventParams

      protected Map<String,Object> _getEventParams(Object context, String contextIdentifier, Set<String> profileIds)
      Get the event params for notification.
      Parameters:
      context - The context
      contextIdentifier - The context identifier
      profileIds - The profiles
      Returns:
      the event params
    • isInheritanceDisallowed

      public boolean isInheritanceDisallowed(String rightAssignmentCtxId, Object jsContext)
      Determines if the inheritance of assignments is disallowed on the given context
      Parameters:
      rightAssignmentCtxId - The id of the right assignment context
      jsContext - The JS object context
      Returns:
      true if the inheritance is disallowed.
    • disallowInheritance

      public void disallowInheritance(String rightAssignmentCtxId, Object jsContext, boolean disallow)
      Allow or disallow the inheritance of assignments on the given context
      Parameters:
      rightAssignmentCtxId - The id of the right assignment context
      jsContext - The JS object context
      disallow - true to disallow the inheritance, false to allow.
    • getInheritedAssignments

      public Map<String,String> getInheritedAssignments(String rightAssignmentCtxId, Object jsContext, List<String> profileIds, String targetType, Map<String,String> identity)
      Get the first permission given by inheritance for a object context and profiles
      Parameters:
      rightAssignmentCtxId - The id of the right assignment context
      jsContext - The JS object context
      profileIds - The list of profiles
      targetType - The type of target : anonymous, any connected users, a user or a group
      identity - The identity of the target. Can be null if the target is anonymous or any connected users
      Returns:
      The first access type given by inheritance for each profile
    • getInheritedAssignment

      public String getInheritedAssignment(String rightAssignmentCtxId, Object jsContext, String profileId, String targetType, Map<String,String> identity)
      Get the first permission given by inheritance for a object context and a specific profile
      Parameters:
      rightAssignmentCtxId - The id of the right assignment context
      jsContext - The JS object context
      profileId - The id of profile
      targetType - The type of target : anonymous, any connected users, a user or a group
      identity - The identity of the target. Can be null if the target is anonymous or any connected users
      Returns:
      The first access type given by inheritance