replace api action group.update with group.add and group.remove

This commit is contained in:
axolotle 2021-03-22 18:41:18 +01:00
parent da3d7db3e6
commit 473c5762c6
2 changed files with 60 additions and 24 deletions

View file

@ -252,30 +252,6 @@ user:
extra:
pattern: *pattern_groupname
### user_group_update()
update:
action_help: Update group
api: PUT /users/groups/<groupname>
arguments:
groupname:
help: Name of the group to be updated
extra:
pattern: *pattern_groupname
-a:
full: --add
help: User(s) to add in the group
nargs: "*"
metavar: USERNAME
extra:
pattern: *pattern_username
-r:
full: --remove
help: User(s) to remove in the group
nargs: "*"
metavar: USERNAME
extra:
pattern: *pattern_username
### user_group_info()
info:
action_help: Get information about a specific group
@ -286,6 +262,38 @@ user:
extra:
pattern: *pattern_username
### user_group_add()
add:
action_help: Update group
api: PUT /users/groups/<groupname>/add/<usernames>
arguments:
groupname:
help: Name of the group to add user(s) to
extra:
pattern: *pattern_groupname
usernames:
help: User(s) to add in the group
nargs: "*"
metavar: USERNAME
extra:
pattern: *pattern_username
### user_group_remove()
remove:
action_help: Update group
api: PUT /users/groups/<groupname>/remove/<usernames>
arguments:
groupname:
help: Name of the group to remove user(s) from
extra:
pattern: *pattern_groupname
usernames:
help: User(s) to remove from the group
nargs: "*"
metavar: USERNAME
extra:
pattern: *pattern_username
permission:
subcategory_help: Manage permissions
actions:

View file

@ -857,6 +857,34 @@ def user_group_info(groupname):
}
def user_group_add(groupname, usernames, force=False, sync_perm=True):
"""
Add user(s) to a group
Keyword argument:
groupname -- Groupname to update
usernames -- User(s) to add in the group
"""
return user_group_update(
groupname, add=usernames, force=force, sync_perm=sync_perm
)
def user_group_remove(groupname, usernames, force=False, sync_perm=True):
"""
Remove user(s) from a group
Keyword argument:
groupname -- Groupname to update
usernames -- User(s) to remove from the group
"""
return user_group_update(
groupname, remove=usernames, force=force, sync_perm=sync_perm
)
#
# Permission subcategory
#