XQuery Function Documentation
http://exist-db.org/xquery/securitymanager
java:org.exist.xquery.functions.securitymanager.SecurityManagerModule
Module for interacting with the Security Manager
sm:add-group-ace
Adds a Group ACE to the ACL of a resource or collection.
- Parameters:
-
$path The path to the resource or collection whoose ACL you wish to add the ACE to. $group-name The name of the group to create an ACE for. $allowed true() if the ACE is allowing the permission mode, or false() if we are denying the permission mode $mode The mode to set on the ACE e.g. 'rwx' - Returns:
- empty()
sm:add-group-manager
Adds a manager to a groups managers. Can only be called by a group manager or DBA.
- Parameters:
-
$group The name of the group to which you wish to add a manager(s). $manager+ The user(s) to add to the group managers. - Returns:
- empty()
sm:add-group-member
Adds a user to a group. Can only be called by a group manager or DBA.
- Parameters:
-
$group The name of the group whoose membership you wish to modify. $member+ The user(s) to add to the group membership. - Returns:
- empty()
sm:add-user-ace
Adds a User ACE to the ACL of a resource or collection.
- Parameters:
-
$path The path to the resource or collection whoose ACL you wish to add the ACE to. $user-name The name of the user to create an ACE for. $allowed true() if the ACE is allowing the permission mode, or false() if we are denying the permission mode $mode The mode to set on the ACE e.g. 'rwx' - Returns:
- empty()
sm:chgrp
Changes the group owner of a resource or collection.
- Parameters:
-
$path The path to the resource or collection whoose group owner you wish to set $group-name The name of the user group owner to set on the resource or collection e.g. 'guest' - Returns:
- empty()
sm:chmod
Changes the mode of a resource or collection.
- Parameters:
-
$path The path to the resource or collection whoose mode you wish to set $mode The mode to set on the resource or collection e.g. 'rwxrwxrwx' - Returns:
- empty()
sm:chown
Changes the owner of a resource or collection.
- Parameters:
-
$path The path to the resource or collection whoose owner you wish to set $owner The name of the user owner to set on the resource or collection e.g. 'guest'. You may also provide a group owner, by using the syntax 'user:group' if you wish. - Returns:
- empty()
sm:clear-acl
Removes all ACEs from the ACL of a resource or collection.
- Parameters:
-
$path The path to the resource or collection whoose ACL you wish to clear. - Returns:
- empty()
sm:create-account
Creates a User Account.
- Parameters:
-
$username The User's username. $password The User's password. $primary-group The primary group of the user. $groups* Any supplementary groups of which the user should be a member. - Returns:
- empty()
sm:create-account
Creates a User Account.
- Parameters:
-
$username The User's username. $password The User's password. $primary-group The primary group of the user. $groups* Any supplementary groups of which the user should be a member. $full-name The full name of the user. $description A description of the user. - Returns:
- empty()
sm:create-account
Creates a User Account and a personal group for that user. The personal group takes the same name as the user, and is set as the user's primary group.
- Parameters:
-
$username The User's username. $password The User's password. $groups* Any supplementary groups of which the user should be a member. - Returns:
- empty()
sm:create-account
Creates a User Account and a personal group for that user. The personal group takes the same name as the user, and is set as the user's primary group.
- Parameters:
-
$username The User's username. $password The User's password. $groups* Any supplementary groups of which the user should be a member. $full-name The full name of the user. $description A description of the user. - Returns:
- empty()
sm:create-group
Creates a User Group. The current user will be set as the group's manager.
- Parameters:
-
$group-name The name of the group to create. - Returns:
- item()
sm:create-group
Creates a User Group. The current user will be set as the group's manager.
- Parameters:
-
$group-name The name of the group to create. $description A description of the group. - Returns:
- item()
sm:create-group
Creates a User Group. The current user will be set as a manager of the group in addition to the specified managers.
- Parameters:
-
$group-name The name of the group to create. $managers+ The usernames of users that will be a manager of this group. $description A description of the group. - Returns:
- item()
sm:delete-group
Removes a User Group. Any resources owned by the group will be moved to the 'guest' group.
- Parameters:
-
$group-id The group-id to delete - Returns:
- item()
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:remove-group' instead! This function could be removed in the next major release version.
sm:find-groups-by-groupname
Finds groups whoose group name starts with a matching string
- Parameters:
-
$starts-with The starting string against which to match group names - Returns:
- xs:string* : The list of matching group names
sm:find-groups-where-groupname-contains
Finds groups whoose group name contains the string fragment
- Parameters:
-
$fragment The fragment against which to match group names - Returns:
- xs:string* : The list of matching group names
sm:find-users-by-name
Finds users whoose personal name starts with a matching string
- Parameters:
-
$starts-with The starting string against which to match a personal name - Returns:
- xs:string* : The list of matching usernames
sm:find-users-by-name-part
Finds users whoose first name or last name starts with a matching string
- Parameters:
-
$starts-with The starting string against which to match a first or last name - Returns:
- xs:string* : The list of matching usernames
sm:find-users-by-username
Finds users whoose username starts with a matching string
- Parameters:
-
$starts-with The starting string against which to match usernames - Returns:
- xs:string* : The list of matching usernames
sm:get-account-metadata
Gets a metadata attribute value for an account
- Parameters:
-
$username The username of the account to retrieve metadata from. $attribute The fully qualified metadata attribute key name - Returns:
- xs:string? : The metadata value
sm:get-account-metadata-keys
Gets a sequence of the metadata attribute keys that may be used for an account.
- Returns:
- xs:anyURI* : The fully qualified metadata attribute key names
sm:get-account-metadata-keys
Gets a sequence of the metadata attribute keys present for an account
- Parameters:
-
$username The username of the account to retrieve metadata from. - Returns:
- xs:anyURI* : The fully qualified metadata attribute key names
sm:get-group-managers
Gets a list of the group managers. Can only be called by a group manager.
- Parameters:
-
$group The group name to retrieve the list of managers for. - Returns:
- xs:string+ : The list of group managers for the group $group
sm:get-group-members
Gets a list of the group members.
- Parameters:
-
$group The group name to retrieve the list of members for. - Returns:
- xs:string+ : The list of group members for the group $group
sm:get-group-metadata
Gets a metadata attribute value for a group
- Parameters:
-
$group-name The name of the group to retrieve metadata from. $attribute The fully qualified metadata attribute key name - Returns:
- xs:string? : The metadata value
sm:get-group-metadata-keys
Gets a sequence of the metadata attribute keys that may be used for a group.
- Returns:
- xs:anyURI* : The fully qualified metadata attribute key names
sm:get-group-metadata-keys
Gets a sequence of the metadata attribute keys present for a group
- Parameters:
-
$group-name The name of the group to retrieve metadata from. - Returns:
- xs:anyURI* : The fully qualified metadata attribute key names
sm:get-groups
List all groups
- Returns:
- xs:string* : The list of groups
- Deprecated:
- Moved to the module: http://exist-db.org/xquery/securitymanager, you should now use 'sm:list-groups' instead! This function could be removed in the next major release version.
sm:get-permissions
Gets the permissions of a resource or collection.
- Parameters:
-
$path The path to the resource or collection to get permissions of. - Returns:
- document-node() : The permissions of the resource or collection
sm:get-umask
Gets the umask of a Users Account.
- Parameters:
-
$username The username of the account to retrieve the umask for. - Returns:
- xs:int* : The umask of the users account expressed as an integer
sm:get-user-groups
Returns the sequence of groups that the user $user is a member of. You must be a DBA or logged in as the user for which you are trying to retrieve group details for.
- Parameters:
-
$user The username to retrieve the group membership list for. - Returns:
- xs:string+ : The users group memberships
sm:get-user-primary-group
Returns the primary group of the user $user. You must be a DBA or logged in as the user for which you are trying to retrieve group details for.
- Parameters:
-
$user The username to retrieve the primary group of. - Returns:
- xs:string : The users primary group
sm:group-exists
Determines whether a user group exists.
- Parameters:
-
$group The name of the user group to check for existence. - Returns:
- xs:boolean : true if the user group exists, false otherwise.
sm:has-access
Checks whether the current user has access to the resource or collection.
- Parameters:
-
$path The path to the resource or collection whoose acess of which you wish to check $mode The partial mode to check against the resource or collection e.g. 'rwx' - Returns:
- xs:boolean
sm:id
Returns the user and group names of the account executing the XQuery. If the real and effective accounts are different, then both the real and effective account details are returned, otherwise only the real account details are returned.
- Returns:
- document-node() : Example output when an XQuery is running setUid <id xmlns="http://exist-db.org/xquery/securitymanager"><real><username>guest</username><groups><group>guest</group></groups></real><effective><username>admin</username><groups><group>dba</group></groups></effective></id>.
sm:insert-group-ace
Inserts a Group ACE into the ACL of a resource or collection.
- Parameters:
-
$path The path to the resource or collection whoose ACL you wish to add the ACE to. $index The index in the ACL to insert the ACE before, subsequent entries will be renumbered $group-name The name of the group to create an ACE for. $allowed true() if the ACE is allowing the permission mode, or false() if we are denying the permission mode $mode The mode to set on the ACE e.g. 'rwx' - Returns:
- empty()
sm:insert-user-ace
Inserts a User ACE into the ACL of a resource or collection.
- Parameters:
-
$path The path to the resource or collection whoose ACL you wish to add the ACE to. $index The index in the ACL to insert the ACE before, subsequent entries will be renumbered $user-name The name of the user to create an ACE for. $allowed true() if the ACE is allowing the permission mode, or false() if we are denying the permission mode $mode The mode to set on the ACE e.g. 'rwx' - Returns:
- empty()
sm:is-account-enabled
Determines whether a user account is enabled. You must be a DBA, or you must be enquiring about your own user account.
- Parameters:
-
$username The username of the account to check the status for. - Returns:
- xs:boolean : true if the account is enabled, false otherwise.
sm:is-authenticated
Returns the true() if current account is authenticated, false() otherwise.
- Returns:
- xs:boolean : true() if user from the xquery context is authenticated, false() otherwise
sm:is-dba
Determines if the user is a DBA.
- Parameters:
-
$username The username of the user account to check if they are a member of the DBA group. - Returns:
- xs:boolean : true of the user is a DBA, false otherwise.
sm:is-externally-authenticated
Returns the true() if current account is authenticated by an external realm, false() otherwise.
- Returns:
- xs:boolean : true() if user from the xquery context is authenticated, false() otherwise
sm:list-groups
List all groups
- Returns:
- xs:string* : The list of groups
sm:list-users
List all users. You must be a DBA to enumerate all users, if you are not a DBA you will just get the username of the currently logged in user.
- Returns:
- xs:string+ : The list of users.
sm:mode-to-octal
Converts a mode string e.g. 'rwxrwxrwx' to an octal number e.g. 0777.
- Parameters:
-
$mode The mode to convert to an octal string. - Returns:
- xs:string
sm:modify-ace
Modified an ACE of an ACL of a resource or collection.
- Parameters:
-
$path The path to the resource or collection whoose ACL you wish to modify the ACE of. $index The index of the ACE in the ACL to modify $allowed true() if the ACE is allowing the permission mode, or false() if we are denying the permission mode $mode The mode to set on the ACE e.g. 'rwx' - Returns:
- empty()
sm:octal-to-mode
Converts an octal string e.g. '0777' to a mode string e.g. 'rwxrwxrwx'.
- Parameters:
-
$octal The octal string to convert to a mode. - Returns:
- xs:string
sm:passwd
Changes the password of a User Account.
- Parameters:
-
$username The User's username. $password The new User's password. - Returns:
- empty()
sm:remove-account
Removes a User Account. If the user has a personal group you are responsible for removing that separately through sm:remove-group.
- Parameters:
-
$username The User's username. - Returns:
- empty()
sm:remove-ace
Removes an ACE from the ACL of a resource or collection.
- Parameters:
-
$path The path to the resource or collection whoose ACL you wish to remove the ACE from. $index The index of the ACE in the ACL to remove, subsequent entries will be renumbered - Returns:
- empty()
sm:remove-group
Remove a User Group. Any resources owned by the group will be moved to the 'guest' group.
- Parameters:
-
$group-name The group-id to delete - Returns:
- item()
sm:remove-group-manager
Removes a manager from a groups managers. Can only be called by a group manager of DBA.
- Parameters:
-
$group The name of the group from which you wish to remove a manager(s) $manager+ The user(s) to remove from the group managers. - Returns:
- empty()
sm:remove-group-member
Removes a user from a group. Can only be called by a group manager of DBA.
- Parameters:
-
$group The name of the group whoose membership you wish to modify. $member+ The user(s) to remove from the group membership. - Returns:
- empty()
sm:set-account-enabled
Enabled or disables a users account. You must be a DBA to enable or disable an account.
- Parameters:
-
$username The username of the account to enable or disable. $enabled true to enable the account, false to disable the account. - Returns:
- empty()
sm:set-account-metadata
Sets a metadata attribute value for an account
- Parameters:
-
$username The username of the account to set metadata for. $attribute The metadata attribute key. $value The metadata value, - Returns:
- empty()
sm:set-group-metadata
Sets a metadata attribute value for a group
- Parameters:
-
$group-name The name of the group to set metadata for. $attribute The metadata attribute key. $value The metadata value, - Returns:
- empty()
sm:set-umask
Sets the umask of a Users Account.
- Parameters:
-
$username The username of the account to set the umask for. $umask The umask to set as an integer. - Returns:
- empty()
sm:set-user-primary-group
Sets the primary group of a user account. If the user is not yet in the group, then they are added to the group first.
- Parameters:
-
$username The name of the user account to set the primary group for. $group The group to set as the primary group for the user. - Returns:
- empty()
sm:user-exists
Determines whether a user exists.
- Parameters:
-
$user The username to check for existence. - Returns:
- xs:boolean : true if the user account exists, false otherwise.