Class CmsAccountsApp

    • Method Detail

      • addGroupContainerProperties

        public void addGroupContainerProperties​(com.vaadin.v7.data.util.IndexedContainer container)
        Adds additional properties for groups to a container.
        Parameters:
        container - the container to update
      • addUserContainerProperties

        public void addUserContainerProperties​(com.vaadin.v7.data.util.IndexedContainer container)
        Adds additional properties for users to a container.
        Parameters:
        container - the container to update
      • canEditUser

        public boolean canEditUser​(CmsUUID id)
        Checks if the given user is editable.

        Parameters:
        id - the id of the user
        Returns:
        true if the user is editable
      • canRemoveGroupMemebers

        public boolean canRemoveGroupMemebers​(java.lang.String group)
        Checks if group members can be removed from the given OU.

        Parameters:
        group - the group name
        Returns:
        true if group members can be removed from the given OU
      • checkAddGroup

        public boolean checkAddGroup​(CmsUser principal,
                                     java.util.Set<java.lang.String> data)
        Checks if a set of groups can be added to a user.

        Parameters:
        principal - the user
        data - the set of names of groups to check
        Returns:
        true if the groups can be added to the user
      • checkRemoveGroups

        public boolean checkRemoveGroups​(CmsUser principal,
                                         java.util.Set<java.lang.String> items)
        Checks if a user can be removed from a set of groups.

        Parameters:
        principal - the user
        items - the names of groups to check
        Returns:
        true if the user can be removed from the group
      • fillGroupItem

        public void fillGroupItem​(com.vaadin.v7.data.Item item,
                                  CmsGroup group,
                                  java.util.List<CmsGroup> indirects)
        Fills the container item representing a group.

        Parameters:
        item - the item
        group - the group
        indirects - the indirect groups
      • getAppId

        public java.lang.String getAppId()
        Gets the app id.

        Returns:
        the app id
      • getAvailableGroupsContainerWithout

        public com.vaadin.v7.data.util.IndexedContainer getAvailableGroupsContainerWithout​(CmsObject cms,
                                                                                           java.lang.String ouFqn,
                                                                                           java.lang.String propCaption,
                                                                                           java.lang.String propIcon,
                                                                                           java.lang.String propOu,
                                                                                           java.util.List<CmsGroup> groupsOfUser,
                                                                                           java.util.function.Function<CmsGroup,​CmsCssIcon> iconProvider)
        Gets a data container for the groups available to be added to a user, excluding some groups.

        Parameters:
        cms - the current CMS context
        ouFqn - the OU for which to get the groups
        propCaption - the property for the caption
        propIcon - the property for the icon
        propOu - the property for the OU
        groupsOfUser - the groups to exclude
        iconProvider - the icon provider
        Returns:
        the container with the group data
      • getGroupIcon

        public CmsCssIcon getGroupIcon​(CmsGroup group)
        Gets the icon for a group.

        Parameters:
        group - the group
        Returns:
        the icon for the group
      • getPasswordResetStateCache

        public java.util.Map<CmsUUID,​java.lang.Boolean> getPasswordResetStateCache()
        Gets the cache for the password reset states.

        The cache keys are user ids.

        Returns:
        the cache for the password reset states
      • getUserGroupsEditorContainer

        public com.vaadin.v7.data.util.IndexedContainer getUserGroupsEditorContainer​(CmsUser user,
                                                                                     java.lang.String propName,
                                                                                     java.lang.String propIcon,
                                                                                     java.lang.String propStatus)
        Gets the container for the groups of an user for the purpose of editing them.

        Parameters:
        user - the user
        propName - the property for the name
        propIcon - the property for the icon
        propStatus - the property for the status
        Returns:
        the container with the user groups
      • getUsersWithoutAdditionalInfo

        public java.util.List<CmsUsergetUsersWithoutAdditionalInfo​(CmsObject cms,
                                                                     I_CmsOuTreeType type,
                                                                     java.lang.String ou,
                                                                     boolean recursive)
                                                              throws CmsException
        Gets list of users for organizational unit.

        Parameters:
        cms - the CMS context
        ou - the OU path
        recursive - true if users from other OUs should be retrieved
        Returns:
        the list of users, without their additional info
        Throws:
        CmsException - if something goes wrong
      • isOUManagable

        public boolean isOUManagable​(java.lang.String ou)
        Checks if the given OU is manageable.

        Parameters:
        ou - to check
        Returns:
        true if user is allowed to manage ou
      • isParentOfManagableOU

        public boolean isParentOfManagableOU​(java.lang.String name)
        Checks if given ou is parent of a managable ou.

        Parameters:
        name - to check
        Returns:
        boolean
      • parseState

        public org.opencms.ui.apps.user.CmsAccountsApp.CmsStateBean parseState​(java.lang.String state,
                                                                               java.lang.String baseOU)
        Parses a given state string to state bean.

        Parameters:
        state - to be read
        baseOU - baseOu
        Returns:
        CmsStateBean
      • readGroupsForOu

        public java.util.List<CmsGroupreadGroupsForOu​(CmsObject cms,
                                                        java.lang.String ou,
                                                        I_CmsOuTreeType type,
                                                        boolean subOus)
                                                 throws CmsException
        Reads the list of groups for an organizational unit.

        Parameters:
        cms - the CMS context
        ou - the OU path
        type - the tree type
        subOus - true if groups for sub-OUs should be read
        Returns:
        the list of groups for the OU
        Throws:
        CmsException - if something goes wrong
      • reload

        public void reload()
        Reloads the app with current state.

      • update

        public void update​(java.lang.String ou,
                           I_CmsOuTreeType type,
                           CmsUUID groupID)
        Updates the app state.

        Parameters:
        ou - to be opened
        type - to be opened
        groupID - to be openend(may be null)
      • update

        public void update​(java.lang.String ou,
                           I_CmsOuTreeType type,
                           CmsUUID roleOrGroupID,
                           java.lang.String filter)
        Updates the app state.

        Parameters:
        ou - to be opened
        type - to be opened
        roleOrGroupID - to be openend(may be null)
        filter - filter string
      • createGroupTable

        protected I_CmsFilterableTable createGroupTable​(java.lang.String path,
                                                        CmsAccountsApp cmsAccountsApp,
                                                        I_CmsOuTreeType type,
                                                        boolean toggle)
        Creates a table for displaying groups.

        Parameters:
        path - the path
        cmsAccountsApp - the app instance
        type - the tree type
        toggle - the value of the 'sub-OU' toggle
        Returns:
        the table
      • createOUTable

        protected I_CmsFilterableTable createOUTable​(java.lang.String ou)
        Creates the overview table for the given OU.

        Parameters:
        ou - the OU path
        Returns:
        the overview table for the given OU
      • createRoleTable

        protected I_CmsFilterableTable createRoleTable​(java.lang.String ou)
        Creates the role table for the given OU.

        Parameters:
        ou - the OU path
        Returns:
        the role table for the given OU
      • createUserTable

        protected I_CmsFilterableTable createUserTable​(java.lang.String ou,
                                                       CmsUUID groupID,
                                                       I_CmsOuTreeType type,
                                                       boolean showAll,
                                                       CmsAccountsApp cmsAccountsApp)
        Creates user table for a specific group or role.

        Parameters:
        ou - the OU path
        groupID - the group id
        type - the tree type
        showAll - true if all users should be shown
        cmsAccountsApp - the app instance
        Returns:
        the user table
      • createUserTable

        protected I_CmsFilterableTable createUserTable​(java.lang.String ou,
                                                       I_CmsOuTreeType type,
                                                       CmsAccountsApp cmsAccountsApp,
                                                       boolean buttonPressed)
        Creates the user table for an OU.

        Parameters:
        ou - the OU path
        type - the tree type
        cmsAccountsApp - the app instance
        buttonPressed - true if toggle button for users is active
        Returns:
        the user table
      • filterTable

        protected void filterTable​(java.lang.String text)
        Filters table.

        "

        Parameters:
        text - for filter
      • getAdditionalButtons

        protected java.util.List<com.vaadin.ui.Button> getAdditionalButtons()
        Gets the additional buttons to display.

        Returns:
        the additional buttons to display
      • getElementName

        protected java.lang.String getElementName​(org.opencms.ui.apps.user.CmsAccountsApp.CmsStateBean stateBean)
        Gets the group-, role-, or ou name.

        Parameters:
        stateBean - to be read out
        Returns:
        Name
      • getFullUser

        protected java.util.List<CmsUsergetFullUser​(java.util.List<CmsUser> users)
        Gets the full user List including additionInfos.

        Parameters:
        users - user list
        Returns:
        List of user
      • getToggleButton

        protected com.vaadin.ui.Button getToggleButton​(org.opencms.ui.apps.user.CmsAccountsApp.CmsStateBean stateBean)
        Get the current toggle button.

        Parameters:
        stateBean - to be read out
        Returns:
        Button
      • getVisibleUser

        protected java.util.List<CmsUsergetVisibleUser()
        Gets all currently visible user.

        Returns:
        List of CmsUser
      • handleSetTable

        protected void handleSetTable​(com.vaadin.ui.Component component)
        Called when new table is shown.

        Parameters:
        component - the table that is displayed
      • openNewDialog

        protected void openNewDialog()
        Opens a dialog for a new item (ou, group or user).