Package org.opencms.workplace.commons
Class CmsChacc
java.lang.Object
org.opencms.workplace.CmsWorkplace
org.opencms.workplace.tools.CmsToolDialog
org.opencms.workplace.CmsDialog
org.opencms.workplace.commons.CmsChacc
Provides methods for building the permission settings dialog.
The following files use this class:
- /commons/chacc.jsp
- Since:
- 6.0.0
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Value for the action: add an access control entry.static final int
Value for the action: delete the permissions.static final int
Value for the action: set the internal use flag.static final String
Request parameter value for the action: add an access control entry.static final String
Request parameter value for the action: delete the permissions.static final String
Request parameter value for the action: set the internal use flag.static final String
The dialog type.static final String
Request parameter name for the inherit permissions parameter.static final String
Request parameter name for the internal use only flag.static final String
Request parameter name for the name parameter.static final String
Request parameter name for the overwrite inherited permissions parameter.static final String
Request parameter name for the responsible parameter.static final String
Request parameter name for the type parameter.static final String
Request parameter name for the view parameter.static final String
Constant for the request parameters suffix: allow.static final String
Constant for the request parameters suffix: deny.Fields inherited from class org.opencms.workplace.CmsDialog
ACTION_CANCEL, ACTION_CLOSEPOPUP, ACTION_CLOSEPOPUP_SAVE, ACTION_CONFIRMED, ACTION_CONTINUE, ACTION_DEFAULT, ACTION_LOCKS_CONFIRMED, ACTION_OK, ACTION_REPORT_BEGIN, ACTION_REPORT_END, ACTION_REPORT_UPDATE, ACTION_SET, ACTION_WAIT, ATTRIBUTE_THROWABLE, BUTTON_ADVANCED, BUTTON_BACK, BUTTON_CANCEL, BUTTON_CLOSE, BUTTON_CONTINUE, BUTTON_DETAILS, BUTTON_DISCARD, BUTTON_EDIT, BUTTON_OK, BUTTON_OK_NO_SUBMIT, BUTTON_SET, DIALOG_BACK, DIALOG_CANCEL, DIALOG_CONFIRMED, DIALOG_CONTINUE, DIALOG_INITIAL, DIALOG_LOCKS_CONFIRMED, DIALOG_OK, DIALOG_SET, DIALOG_WAIT, PARAM_ACTION, PARAM_ACTION_VALUE_FOR_CHANGED_INDEX, PARAM_CLOSELINK, PARAM_DIALOGTYPE, PARAM_ERRORSTACK, PARAM_FILE, PARAM_FRAMENAME, PARAM_ISPOPUP, PARAM_LOCK, PARAM_MESSAGE, PARAM_ORIGINALPARAMS, PARAM_PREACTIONDONE, PARAM_REDIRECT, PARAM_RESOURCE, PARAM_TARGET, PARAM_THREAD, PARAM_THREAD_HASNEXT, PARAM_TITLE, REPORT_BEGIN, REPORT_END, REPORT_UPDATE
Fields inherited from class org.opencms.workplace.tools.CmsToolDialog
PARAM_ADMIN_PROJECT, PARAM_BASE, PARAM_FORCE, PARAM_PATH, PARAM_ROOT, PARAM_STYLE, STYLE_NEW
Fields inherited from class org.opencms.workplace.CmsWorkplace
DEBUG, DEFAULT_DATE_STRING, DEFAULT_LANGUAGE, DEFAULT_LOCALE, DIALOG_PATH_COMMON, FILE_DIALOG_CLOSE, FILE_DIALOG_SCREEN_CONFIRM, FILE_DIALOG_SCREEN_ERROR, FILE_DIALOG_SCREEN_ERRORPAGE, FILE_DIALOG_SCREEN_WAIT, FILE_EXPLORER_FILELIST, FILE_REPORT_OUTPUT, HTML_END, HTML_START, INPUT_DEFAULT, INPUT_NONE, JSP_WORKPLACE_URI, PARAM_DIRECTPUBLISH, PARAM_MODELFILE, PARAM_NEWRESOURCETYPE, PARAM_PUBLISHSIBLINGS, PARAM_RELATEDRESOURCES, PARAM_RESOURCELIST, PARAM_SUBRESOURCES, PARAM_WP_EXPLORER_RESOURCE, PARAM_WP_PROJECT, PARAM_WP_SITE, PARAM_WP_START, PARAM_WP_VIEW, PATH_DIALOGS, PATH_WORKPLACE, REQUEST_ATTRIBUTE_MULTIPART, REQUEST_ATTRIBUTE_RELOADTREE, RES_PATH_FILETYPES, RFS_PATH_RESOURCES, SESSION_WORKPLACE_CLASS, VFS_DIR_DEFAULTBODIES, VFS_DIR_TEMPLATES, VFS_PATH_COMMONS, VFS_PATH_EDITORS, VFS_PATH_GALLERIES, VFS_PATH_LOCALES, VFS_PATH_MODELDIALOG, VFS_PATH_MODULES, VFS_PATH_NEWRESOURCEDIALOG, VFS_PATH_RESOURCES, VFS_PATH_SITES, VFS_PATH_SYSTEM, VFS_PATH_VIEWS, VFS_PATH_WORKPLACE, VIEW_ADMIN, VIEW_DIRECT_EDIT, VIEW_EXPLORER, VIEW_GALLERY, VIEW_LIST, VIEW_WORKPLACE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a new access control entry to the resource.boolean
actionInternalUse
(javax.servlet.http.HttpServletRequest request) Modifies the Internal Use flag of a resource.boolean
actionModifyAce
(javax.servlet.http.HttpServletRequest request) Modifies a present access control entry for a resource.boolean
Removes a present access control entry from the resource.Builds a String with HTML code to display the users access rights for the current resource.Returns the error messages if something went wrong.buildResponsibleList
(boolean show) Builds a String with HTML code to display the responsible users of a resource.Builds a String with HTML code to display the inherited and own access control entries of a resource.static String
buildSummaryDetailsButtons
(org.opencms.workplace.CmsDialog wp) Builds a detail view selector.protected boolean
checkNewEntry
(String name, int arrayPosition) Validates the user input when creating a new access control entry.protected String
getConnectedResource
(org.opencms.security.CmsAccessControlEntry entry, Map<org.opencms.util.CmsUUID, String> parents) Returns the resource on which the specified access control entry was set.org.opencms.security.CmsPermissionSet
Returns the current users permission set on the resource.protected boolean
Returns the current editable flag for the user to change ACEs.protected String
getEntryType
(int flags, boolean all) Determines the type of the current access control entry.protected int
getEntryTypeInt
(int flags) Determines the int type of the current access control entry.Returns a list with all error messages which occurred when trying to add a new access control entry.Returns a String with all error messages occuring when trying to add a new access control entry.protected boolean
Returns if the access control entry can be inherited to subfolders and can overwrite inherited permissions.Returns the value of the name parameter, or null if this parameter was not provided.Returns the value of the type parameter, or null if this parameter was not provided.Returns the UUID parameter.boolean
Returns if the inherited permissions information should be displayed.protected String[]
getTypes
(boolean all) Returns a String array with the possible entry types.protected int[]
Returns an int array with possible entry types.protected String[]
Returns a String array with the possible localized entry types.void
init()
Initializes some member variables to display the form with the right options for the current user.protected void
initWorkplaceRequestValues
(org.opencms.workplace.CmsWorkplaceSettings settings, javax.servlet.http.HttpServletRequest request) protected boolean
isAllowed
(org.opencms.security.CmsPermissionSet p, int value) Checks if a certain permission of a permission set is allowed.protected boolean
isDenied
(org.opencms.security.CmsPermissionSet p, int value) Checks if a certain permission of a permission set is denied.protected boolean
isOverWritingInherited
(int flags) Check if the current permissions are overwriting the inherited ones.protected boolean
isResponsible
(int flags) Check if the user is a responsible for the resource.protected void
setCurPermissions
(org.opencms.security.CmsPermissionSet value) Sets the current users permissions on the resource.protected void
setEditable
(boolean value) Sets the editable flag for the forms.protected void
setInheritOption
(boolean value) Sets if the access control entry can be inherited to subfolders and can overwrite inherited permissions.void
setParamName
(String value) Sets the value of the name parameter.void
setParamType
(String value) Sets the value of the type parameter.void
setParamUuid
(String uuid) Sets the UUID parameter.protected void
setShowInheritedPermissions
(boolean showInheritedPermissions) Sets if the inherited permissions information should be displayed.Methods inherited from class org.opencms.workplace.CmsDialog
actionCloseDialog, appendDelimiter, buildAjaxResultContainer, buildAjaxWaitMessage, buildLockAdditionalOptions, buildLockConfirmationMessageJS, buildLockHeaderBox, checkResourcePermissions, checkResourcePermissions, computeCurrentFolder, dialog, dialogBlock, dialogBlockEnd, dialogBlockStart, dialogButtonRow, dialogButtonRowEnd, dialogButtonRowStart, dialogButtons, dialogButtonsClose, dialogButtonsClose, dialogButtonsCloseDetails, dialogButtonsHtml, dialogButtonsOk, dialogButtonsOk, dialogButtonsOkCancel, dialogButtonsOkCancel, dialogButtonsOkCancelAdvanced, dialogButtonsSetOkCancel, dialogContent, dialogContentEnd, dialogContentStart, dialogEnd, dialogHead, dialogHorizontalSpacer, dialogLockButtons, dialogRow, dialogRowEnd, dialogRowStart, dialogScriptSubmit, dialogSeparator, dialogSpacer, dialogStart, dialogStart, dialogSubheadline, dialogToggleStart, dialogWhiteBox, dialogWhiteBoxEnd, dialogWhiteBoxStart, getAction, getAdministrationBackLink, getCancelAction, getDialogRealUri, getDialogUri, getOnlineHelpUriCustom, getParamAction, getParamCloseLink, getParamDialogtype, getParamFramename, getParamIsPopup, getParamMessage, getParamOriginalParams, getParamPreActionDone, getParamRedirect, getParamResource, getParamTitle, getState, hasCorrectLockstate, hasSiblings, htmlStart, htmlStart, htmlStartStyle, includeErrorpage, initCmsDialog, isPopup, isPreEditor, openLaunchpad, openWorkplaceLink, pageHtml, pageHtml, setAction, setOnlineHelpUriCustom, setParamAction, setParamCloseLink, setParamDialogtype, setParamFramename, setParamIsPopup, setParamMessage, setParamOriginalParams, setParamPreActionDone, setParamRedirect, setParamResource, setParamTitle
Methods inherited from class org.opencms.workplace.tools.CmsToolDialog
computeUpLevelLink, dialogTitle, getAdminTool, getCurrentToolPath, getParamBase, getParamForce, getParamPath, getParamRoot, getParamStyle, getParentPath, getToolManager, iconsBlockArea, iconsBlockAreaEnd, iconsBlockAreaStart, initAdminTool, pageBody, pageHtmlStyle, setParamBase, setParamForce, setParamPath, setParamRoot, setParamStyle, useNewStyle
Methods inherited from class org.opencms.workplace.CmsWorkplace
addMessages, addMessages, allParamsAsHidden, allParamsAsRequest, allParamValues, bodyEnd, bodyStart, bodyStart, buildSelect, buildSelect, button, button, buttonBar, buttonBar, buttonBarHorizontalLine, buttonBarLabel, buttonBarLabel, buttonBarLine, buttonBarLineSpacer, buttonBarSeparator, buttonBarSpacer, buttonBarStartTab, canEditPermissionsForRoles, checkLock, checkLock, checkRole, decodeParamValue, fillParamValues, fillParamValues, generateCssStyle, generatePageEndExtended, generatePageEndSimple, generatePageStartExtended, generatePageStartSimple, getBroadcastMessageString, getCms, getEncoding, getExplorerFileListFullUri, getFrameSource, getJsp, getLocale, getMacroResolver, getMessages, getMultiPartFileItems, getParameterMap, getResourceUri, getResourceUri, getSession, getSettings, getSkinUri, getStartSiteRoot, getStartSiteRoot, getStaticResourceUri, getStaticResourceUri, getStyleUri, getStyleUri, getStyleUri, getTemporaryFileName, getWorkplaceExplorerLink, getWorkplaceExplorerLink, getWorkplaceSettings, htmlEnd, initMessages, initSettings, initTimeWarp, initUserSettings, initWorkplaceMembers, initWorkplaceMembers, initWorkplaceSettings, isForwarded, isHelpEnabled, isSubElement, isTemporaryFile, key, key, keyDefault, nullToEmpty, paramsAsHidden, paramsAsHidden, paramsAsParameterMap, paramsAsRequest, paramValues, resolveMacros, sendCmsRedirect, sendForward, setForwarded, shortKey, substituteSiteTitle, substituteSiteTitleStatic, switchToCurrentProject, switchToTempProject, updateUserPreferences
-
Field Details
-
ACTION_ADDACE
Value for the action: add an access control entry.- See Also:
-
ACTION_DELETE
Value for the action: delete the permissions.- See Also:
-
ACTION_INTERNALUSE
Value for the action: set the internal use flag.- See Also:
-
DIALOG_ADDACE
Request parameter value for the action: add an access control entry.- See Also:
-
DIALOG_DELETE
Request parameter value for the action: delete the permissions.- See Also:
-
DIALOG_INTERNALUSE
Request parameter value for the action: set the internal use flag.- See Also:
-
DIALOG_TYPE
The dialog type.- See Also:
-
PARAM_INHERIT
Request parameter name for the inherit permissions parameter.- See Also:
-
PARAM_INTERNAL
Request parameter name for the internal use only flag.- See Also:
-
PARAM_NAME
Request parameter name for the name parameter.- See Also:
-
PARAM_OVERWRITEINHERITED
Request parameter name for the overwrite inherited permissions parameter.- See Also:
-
PARAM_RESPONSIBLE
Request parameter name for the responsible parameter.- See Also:
-
PARAM_TYPE
Request parameter name for the type parameter.- See Also:
-
PARAM_VIEW
Request parameter name for the view parameter.- See Also:
-
PERMISSION_ALLOW
Constant for the request parameters suffix: allow.- See Also:
-
PERMISSION_DENY
Constant for the request parameters suffix: deny.- See Also:
-
-
Constructor Details
-
CmsChacc
Public constructor.- Parameters:
jsp
- an initialized JSP action element
-
CmsChacc
public CmsChacc(javax.servlet.jsp.PageContext context, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) Public constructor with JSP variables.- Parameters:
context
- the JSP page contextreq
- the JSP requestres
- the JSP response
-
-
Method Details
-
buildSummaryDetailsButtons
Builds a detail view selector.- Parameters:
wp
- the dialog object- Returns:
- the HTML code for the detail view selector
-
actionAddAce
Adds a new access control entry to the resource.- Returns:
- true if a new ace was created, otherwise false
-
actionInternalUse
Modifies the Internal Use flag of a resource.- Parameters:
request
- the Http servlet request- Returns:
- true if the operation was was successfully removed, otherwise false
-
actionModifyAce
Modifies a present access control entry for a resource.- Parameters:
request
- the Http servlet request- Returns:
- true if the modification worked, otherwise false
-
actionRemoveAce
Removes a present access control entry from the resource.- Returns:
- true if the ace was successfully removed, otherwise false
-
buildCurrentPermissions
Builds a String with HTML code to display the users access rights for the current resource.- Returns:
- HTML String with the access rights of the current user
-
buildErrorMessages
Returns the error messages if something went wrong.- Returns:
- all error messages
-
buildResponsibleList
Builds a String with HTML code to display the responsible users of a resource.- Parameters:
show
- true the responsible list is open- Returns:
- HTML code for the responsible users of the current resource
-
buildRightsList
Builds a String with HTML code to display the inherited and own access control entries of a resource.- Returns:
- HTML code for inherited and own entries of the current resource
-
getCurPermissions
Returns the current users permission set on the resource.- Returns:
- the users permission set
-
getErrorMessages
Returns a list with all error messages which occurred when trying to add a new access control entry.- Returns:
- List of error message Strings
-
getErrorMessagesString
Returns a String with all error messages occuring when trying to add a new access control entry.- Returns:
- String with error messages, separated by <br>
-
getParamName
Returns the value of the name parameter, or null if this parameter was not provided.The name parameter stores the name of the group or user.
- Returns:
- the value of the name parameter
-
getParamType
Returns the value of the type parameter, or null if this parameter was not provided.The type parameter stores the type of an ace (group or user).
- Returns:
- the value of the type parameter
-
getParamUuid
Returns the UUID parameter.- Returns:
- the UUID parameter
-
getShowInheritedPermissions
Returns if the inherited permissions information should be displayed.- Returns:
- true if the inherited permissions information should be displayed, otherwise false
-
htmlStart
- Overrides:
htmlStart
in classorg.opencms.workplace.CmsDialog
- See Also:
-
CmsDialog.htmlStart()
-
init
Initializes some member variables to display the form with the right options for the current user.This method must be called after initWorkplaceRequestValues().
-
setParamName
Sets the value of the name parameter.- Parameters:
value
- the value to set
-
setParamType
Sets the value of the type parameter.- Parameters:
value
- the value to set
-
setParamUuid
Sets the UUID parameter.- Parameters:
uuid
- the UUID to set
-
checkNewEntry
Validates the user input when creating a new access control entry.- Parameters:
name
- the name of the new user/grouparrayPosition
- the position in the types array- Returns:
- true if everything is ok, otherwise false
-
getConnectedResource
protected String getConnectedResource(org.opencms.security.CmsAccessControlEntry entry, Map<org.opencms.util.CmsUUID, String> parents) Returns the resource on which the specified access control entry was set.- Parameters:
entry
- the current access control entryparents
- the parent resources to determine the connected resource- Returns:
- the resource name of the corresponding resource
-
getEditable
Returns the current editable flag for the user to change ACEs.- Returns:
- true if user can edit the permissions, otherwise false
-
getEntryType
Determines the type of the current access control entry.- Parameters:
flags
- the value of the current flagsall
- to include all types, or just user and groups- Returns:
- String representation of the ace type
-
getEntryTypeInt
Determines the int type of the current access control entry.- Parameters:
flags
- the value of the current flags- Returns:
- int representation of the ace type as int
-
getInheritOption
Returns if the access control entry can be inherited to subfolders and can overwrite inherited permissions.- Returns:
- true to show the checkbox, otherwise false
-
getTypes
Returns a String array with the possible entry types.- Parameters:
all
- to include all types, or just user, groups and roles- Returns:
- the possible types
-
getTypesInt
Returns an int array with possible entry types.- Returns:
- the possible types as int array
-
getTypesLocalized
Returns a String array with the possible localized entry types.- Returns:
- the possible localized types
-
initWorkplaceRequestValues
protected void initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings settings, javax.servlet.http.HttpServletRequest request) - Overrides:
initWorkplaceRequestValues
in classorg.opencms.workplace.CmsDialog
- See Also:
-
CmsWorkplace.initWorkplaceRequestValues(org.opencms.workplace.CmsWorkplaceSettings, javax.servlet.http.HttpServletRequest)
-
isAllowed
Checks if a certain permission of a permission set is allowed.- Parameters:
p
- the current CmsPermissionSetvalue
- the int value of the permission to check- Returns:
- true if the permission is allowed, otherwise false
-
isDenied
Checks if a certain permission of a permission set is denied.- Parameters:
p
- the current CmsPermissionSetvalue
- the int value of the permission to check- Returns:
- true if the permission is denied, otherwise false
-
isOverWritingInherited
Check if the current permissions are overwriting the inherited ones.- Parameters:
flags
- value of all flags of the current entry- Returns:
- true if permissions are overwriting the inherited ones, otherwise false
-
isResponsible
Check if the user is a responsible for the resource.- Parameters:
flags
- value of all flags of the current entry- Returns:
- true if user is responsible for the resource, otherwise false
-
setCurPermissions
Sets the current users permissions on the resource. This is set in the init() method.- Parameters:
value
- the CmsPermissionSet
-
setEditable
Sets the editable flag for the forms. This is set in the init() method.- Parameters:
value
- true if user can edit the permissions, otherwise false
-
setInheritOption
Sets if the access control entry can be inherited to subfolders and can overwrite inherited permissions.This is set in the init() method.
- Parameters:
value
- set to true for folders, otherwise false
-
setShowInheritedPermissions
Sets if the inherited permissions information should be displayed.- Parameters:
showInheritedPermissions
- true if the inherited permissions information should be displayed, otherwise false
-