Package org.opencms.ui.apps.user
Class CmsAccountsApp
- java.lang.Object
-
- org.opencms.ui.apps.A_CmsWorkplaceApp
-
- org.opencms.ui.apps.user.CmsAccountsApp
-
- All Implemented Interfaces:
I_CmsWorkplaceApp
,I_CmsPrincipalSelect
public class CmsAccountsApp extends A_CmsWorkplaceApp implements I_CmsPrincipalSelect
App for the OU Management.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.opencms.ui.apps.A_CmsWorkplaceApp
A_CmsWorkplaceApp.NavEntry
-
-
Field Summary
Fields Modifier and Type Field Description protected com.vaadin.ui.Button
m_addElementButton
Button to add an element.protected CmsObject
m_cms
CmsObject.protected CmsInfoButton
m_infoButton
vaadin component.protected com.vaadin.ui.Button
m_newButton
vaadin component.protected com.vaadin.ui.Button
m_toggleButtonGroups
vaadin component.protected com.vaadin.ui.Button
m_toggleButtonRole
vaadin component.protected com.vaadin.ui.Button
m_toggleButtonUser
vaadin component.static java.lang.String
STATE_SEPERATOR
State seperator.-
Fields inherited from class org.opencms.ui.apps.A_CmsWorkplaceApp
m_infoLayout, m_rootLayout, m_uiContext, PARAM_ASSIGN, PARAM_SEPARATOR
-
-
Constructor Summary
Constructors Constructor Description CmsAccountsApp()
constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGroupContainerProperties(com.vaadin.v7.data.util.IndexedContainer container)
Adds additional properties for groups to a container.void
addUserContainerProperties(com.vaadin.v7.data.util.IndexedContainer container)
Adds additional properties for users to a container.boolean
canEditUser(CmsUUID id)
Checks if the given user is editable.boolean
canRemoveGroupMemebers(java.lang.String group)
Checks if group members can be removed from the given OU.boolean
checkAddGroup(CmsUser principal, java.util.Set<java.lang.String> data)
Checks if a set of groups can be added to a user.boolean
checkRemoveGroups(CmsUser principal, java.util.Set<java.lang.String> items)
Checks if a user can be removed from a set of groups.protected I_CmsFilterableTable
createGroupTable(java.lang.String path, CmsAccountsApp cmsAccountsApp, I_CmsOuTreeType type, boolean toggle)
Creates a table for displaying groups.protected I_CmsFilterableTable
createOUTable(java.lang.String ou)
Creates the overview table for the given OU.protected I_CmsFilterableTable
createRoleTable(java.lang.String ou)
Creates the role table for the given OU.protected I_CmsFilterableTable
createUserTable(java.lang.String ou, I_CmsOuTreeType type, CmsAccountsApp cmsAccountsApp, boolean buttonPressed)
Creates the user table for an OU.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.void
fillGroupItem(com.vaadin.v7.data.Item item, CmsGroup group, java.util.List<CmsGroup> indirects)
Fills the container item representing a group.protected void
filterTable(java.lang.String text)
Filters table.protected java.util.List<com.vaadin.ui.Button>
getAdditionalButtons()
Gets the additional buttons to display.java.lang.String
getAppId()
Gets the app id.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.protected java.util.LinkedHashMap<java.lang.String,java.lang.String>
getBreadCrumbForState(java.lang.String state)
Returns the current bread crumb entries in an ordered map.protected com.vaadin.ui.Component
getComponentForState(java.lang.String state)
Returns the app component for the given state.protected java.lang.String
getElementName(org.opencms.ui.apps.user.CmsAccountsApp.CmsStateBean stateBean)
Gets the group-, role-, or ou name.protected java.util.List<CmsUser>
getFullUser(java.util.List<CmsUser> users)
Gets the full user List including additionInfos.CmsGroupEditParameters
getGroupEditParameters(CmsGroup group)
Gets the group edit parameters for a given group.CmsCssIcon
getGroupIcon(CmsGroup group)
Gets the icon for a group.static CmsResourceInfo
getOUInfo(CmsOrganizationalUnit ou)
Creates info panel for OUs.static CmsResourceInfo
getPrincipalInfo(I_CmsPrincipal principal)
Creates info panel for principals.protected java.util.List<A_CmsWorkplaceApp.NavEntry>
getSubNavEntries(java.lang.String state)
Returns the sub navigation entries.protected com.vaadin.ui.Button
getToggleButton(org.opencms.ui.apps.user.CmsAccountsApp.CmsStateBean stateBean)
Get the current toggle button.protected I_CmsTreeTypeProvider
getTreeTypeProvider()
Gets the tree type provider.CmsUserEditParameters
getUserEditParameters(CmsUser user)
Gets the user edit parameters.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.java.util.List<CmsUser>
getUsersWithoutAdditionalInfo(CmsObject cms, I_CmsOuTreeType type, java.lang.String ou, boolean recursive)
Gets list of users for organizational unit.protected java.util.List<CmsUser>
getVisibleUser()
Gets all currently visible user.void
handlePrincipal(I_CmsPrincipal principal)
Handles a selected principal.protected void
handleSetTable(com.vaadin.ui.Component component)
Called when new table is shown.void
initUI(I_CmsAppUIContext context)
Within this method the app UI should be initialized.boolean
isOUManagable(java.lang.String ou)
Checks if the given OU is manageable.boolean
isParentOfManagableOU(java.lang.String name)
Checks if given ou is parent of a managable ou.protected void
openNewDialog()
Opens a dialog for a new item (ou, group or user).void
openSubView(java.lang.String state, boolean updateState)
Opens the requested sub view.org.opencms.ui.apps.user.CmsAccountsApp.CmsStateBean
parseState(java.lang.String state, java.lang.String baseOU)
Parses a given state string to state bean.java.util.List<CmsGroup>
readGroupsForOu(CmsObject cms, java.lang.String ou, I_CmsOuTreeType type, boolean subOus)
Reads the list of groups for an organizational unit.void
reload()
Reloads the app with current state.void
update(java.lang.String ou, I_CmsOuTreeType type, CmsUUID groupID)
Updates the app state.void
update(java.lang.String ou, I_CmsOuTreeType type, CmsUUID roleOrGroupID, java.lang.String filter)
Updates the app state.-
Methods inherited from class org.opencms.ui.apps.A_CmsWorkplaceApp
addParamToState, addSubNavEntry, getLastPathLevel, getOfflineCmsObject, getParamFromState, getParamsFromState, onStateChange, removeParamsFromState, setBreadCrumbEntries, updateBreadCrumb, updateSubNav
-
-
-
-
Field Detail
-
STATE_SEPERATOR
public static java.lang.String STATE_SEPERATOR
State seperator.
-
m_addElementButton
protected com.vaadin.ui.Button m_addElementButton
Button to add an element.
-
m_infoButton
protected CmsInfoButton m_infoButton
vaadin component.
-
m_newButton
protected com.vaadin.ui.Button m_newButton
vaadin component.
-
m_toggleButtonGroups
protected com.vaadin.ui.Button m_toggleButtonGroups
vaadin component.
-
m_toggleButtonRole
protected com.vaadin.ui.Button m_toggleButtonRole
vaadin component.
-
m_toggleButtonUser
protected com.vaadin.ui.Button m_toggleButtonUser
vaadin component.
-
-
Constructor Detail
-
CmsAccountsApp
public CmsAccountsApp()
constructor.
-
-
Method Detail
-
getOUInfo
public static CmsResourceInfo getOUInfo(CmsOrganizationalUnit ou)
Creates info panel for OUs.- Parameters:
ou
- to get panel for- Returns:
- CmsResourceInfo
-
getPrincipalInfo
public static CmsResourceInfo getPrincipalInfo(I_CmsPrincipal principal)
Creates info panel for principals.- Parameters:
principal
- to get info panel for- Returns:
- CmsResourceInfo
-
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 userdata
- 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 useritems
- 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 itemgroup
- the groupindirects
- 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 contextouFqn
- the OU for which to get the groupspropCaption
- the property for the captionpropIcon
- the property for the iconpropOu
- the property for the OUgroupsOfUser
- the groups to excludeiconProvider
- the icon provider- Returns:
- the container with the group data
-
getGroupEditParameters
public CmsGroupEditParameters getGroupEditParameters(CmsGroup group)
Gets the group edit parameters for a given group.- Parameters:
group
- a group- Returns:
- the group edit parameters for the group
-
getGroupIcon
public CmsCssIcon getGroupIcon(CmsGroup group)
Gets the icon for a group.- Parameters:
group
- the group- Returns:
- the icon for the group
-
getUserEditParameters
public CmsUserEditParameters getUserEditParameters(CmsUser user)
Gets the user edit parameters.- Parameters:
user
- the user- Returns:
- the user edit parameters
-
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 userpropName
- the property for the namepropIcon
- the property for the iconpropStatus
- the property for the status- Returns:
- the container with the user groups
-
getUsersWithoutAdditionalInfo
public java.util.List<CmsUser> getUsersWithoutAdditionalInfo(CmsObject cms, I_CmsOuTreeType type, java.lang.String ou, boolean recursive) throws CmsException
Gets list of users for organizational unit.- Parameters:
cms
- the CMS contextou
- the OU pathrecursive
- true if users from other OUs should be retrieved- Returns:
- the list of users, without their additional info
- Throws:
CmsException
- if something goes wrong
-
handlePrincipal
public void handlePrincipal(I_CmsPrincipal principal)
Description copied from interface:I_CmsPrincipalSelect
Handles a selected principal.- Specified by:
handlePrincipal
in interfaceI_CmsPrincipalSelect
- Parameters:
principal
- which were selected- See Also:
I_CmsPrincipalSelect.handlePrincipal(org.opencms.security.I_CmsPrincipal)
-
initUI
public void initUI(I_CmsAppUIContext context)
Description copied from interface:I_CmsWorkplaceApp
Within this method the app UI should be initialized.Use the context to add the app's components to the UI.
- Specified by:
initUI
in interfaceI_CmsWorkplaceApp
- Overrides:
initUI
in classA_CmsWorkplaceApp
- Parameters:
context
- the UI context- See Also:
A_CmsWorkplaceApp.initUI(org.opencms.ui.apps.I_CmsAppUIContext)
-
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
-
openSubView
public void openSubView(java.lang.String state, boolean updateState)
Description copied from class:A_CmsWorkplaceApp
Opens the requested sub view.- Overrides:
openSubView
in classA_CmsWorkplaceApp
- Parameters:
state
- the stateupdateState
-true
to update the state URL token- See Also:
A_CmsWorkplaceApp.openSubView(java.lang.String, 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 readbaseOU
- baseOu- Returns:
- CmsStateBean
-
readGroupsForOu
public java.util.List<CmsGroup> readGroupsForOu(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 contextou
- the OU pathtype
- the tree typesubOus
- 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 openedtype
- to be openedgroupID
- 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 openedtype
- to be openedroleOrGroupID
- 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 pathcmsAccountsApp
- the app instancetype
- the tree typetoggle
- 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 pathgroupID
- the group idtype
- the tree typeshowAll
- true if all users should be showncmsAccountsApp
- 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 pathtype
- the tree typecmsAccountsApp
- the app instancebuttonPressed
- 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
-
getBreadCrumbForState
protected java.util.LinkedHashMap<java.lang.String,java.lang.String> getBreadCrumbForState(java.lang.String state)
Description copied from class:A_CmsWorkplaceApp
Returns the current bread crumb entries in an ordered map.- Specified by:
getBreadCrumbForState
in classA_CmsWorkplaceApp
- Parameters:
state
- the current state- Returns:
- bread crumb entry name by state, in case the state is empty, the entry will be disabled
- See Also:
A_CmsWorkplaceApp.getBreadCrumbForState(java.lang.String)
-
getComponentForState
protected com.vaadin.ui.Component getComponentForState(java.lang.String state)
Description copied from class:A_CmsWorkplaceApp
Returns the app component for the given state.- Specified by:
getComponentForState
in classA_CmsWorkplaceApp
- Parameters:
state
- the state to render- Returns:
- the app component
- See Also:
A_CmsWorkplaceApp.getComponentForState(java.lang.String)
-
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<CmsUser> getFullUser(java.util.List<CmsUser> users)
Gets the full user List including additionInfos.- Parameters:
users
- user list- Returns:
- List of user
-
getSubNavEntries
protected java.util.List<A_CmsWorkplaceApp.NavEntry> getSubNavEntries(java.lang.String state)
Description copied from class:A_CmsWorkplaceApp
Returns the sub navigation entries.- Specified by:
getSubNavEntries
in classA_CmsWorkplaceApp
- Parameters:
state
- the state- Returns:
- the sub navigation entries
- See Also:
A_CmsWorkplaceApp.getSubNavEntries(java.lang.String)
-
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
-
getTreeTypeProvider
protected I_CmsTreeTypeProvider getTreeTypeProvider()
Gets the tree type provider.- Returns:
- the tree type provider
-
getVisibleUser
protected java.util.List<CmsUser> getVisibleUser()
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).
-
-