AclDestroyGroup: Difference between revisions
Jump to navigation
Jump to search
m (Doesn't take an acl group as argument, but a string) |
(Added example.) |
||
Line 20: | Line 20: | ||
==Example== | ==Example== | ||
<!-- Explain what the example is in a single sentance --> | <!-- Explain what the example is in a single sentance --> | ||
This example | This example allows admins to remove an ACL group they specify. | ||
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --> | <!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized --> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function removeACLGroup ( source, command, groupName ) | ||
-- Check if they're an admin... | |||
if ( isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source )), aclGetGroup ( "Admin" ) ) ) then | |||
if ( groupName ) then -- Check if they specified the group name | |||
local group = aclGetGroup ( groupName ) -- Return any groups matching the name | |||
if ( group ) then -- If any were returned then... | |||
aclDestroyGroup ( group ) -- Destroy that group | |||
else | |||
-- Tell them if no groups with that name were found... | |||
outputChatBox ( "No group with that name was found.", source, 255, 0, 0 ) | |||
end | |||
else -- If they didn't specify the group | |||
outputChatBox ( "Please specify the group name.", source, 255, 0, 0 ) -- Tell them that they must | |||
end | |||
else -- If they're not an admin.... | |||
outputChatBox ( "You must be an admin to use this command", source, 255, 0, 0 ) -- Tell them it's restricted | |||
end | |||
end | |||
addCommandHandler ( "removeACL", removeACLGroup ) -- Make it happen when somebody types "/removeACL" | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 18:32, 21 February 2010
This function destroys the given ACL group. The destroyed ACL group will no longer be valid.
Syntax
bool aclDestroyGroup ( string aclGroupName )
Required Arguments
- aclGroupName: The name of ACL group to destroy
Returns
Returns true if the ACL group was successfully deleted, false if it could not be deleted for some reason (ie. invalid argument).
Example
This example allows admins to remove an ACL group they specify.
function removeACLGroup ( source, command, groupName ) -- Check if they're an admin... if ( isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( source )), aclGetGroup ( "Admin" ) ) ) then if ( groupName ) then -- Check if they specified the group name local group = aclGetGroup ( groupName ) -- Return any groups matching the name if ( group ) then -- If any were returned then... aclDestroyGroup ( group ) -- Destroy that group else -- Tell them if no groups with that name were found... outputChatBox ( "No group with that name was found.", source, 255, 0, 0 ) end else -- If they didn't specify the group outputChatBox ( "Please specify the group name.", source, 255, 0, 0 ) -- Tell them that they must end else -- If they're not an admin.... outputChatBox ( "You must be an admin to use this command", source, 255, 0, 0 ) -- Tell them it's restricted end end addCommandHandler ( "removeACL", removeACLGroup ) -- Make it happen when somebody types "/removeACL"
See Also
- aclCreate
- aclCreateGroup
- aclDestroy
- aclDestroyGroup
- aclGet
- aclGetGroup
- aclGetName
- aclGetRight
- aclGroupAddACL
- aclGroupAddObject
- aclGroupGetName
- aclGroupList
- aclGroupListACL
- aclGroupListObjects
- aclGroupRemoveACL
- aclGroupRemoveObject
- aclList
- aclListRights
- aclReload
- aclRemoveRight
- aclSave
- aclSetRight
- hasObjectPermissionTo
- isObjectInACLGroup