mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
separate update, add and remove permission on exposed API
This commit is contained in:
parent
1fb9ddd42a
commit
5f994bba98
2 changed files with 50 additions and 23 deletions
|
@ -319,20 +319,6 @@ user:
|
||||||
arguments:
|
arguments:
|
||||||
permission:
|
permission:
|
||||||
help: Permission to manage (e.g. mail or nextcloud or wordpress.editors) (use "yunohost user permission list" and "yunohost user permission -f" to see all the current permissions)
|
help: Permission to manage (e.g. mail or nextcloud or wordpress.editors) (use "yunohost user permission list" and "yunohost user permission -f" to see all the current permissions)
|
||||||
-a:
|
|
||||||
full: --add
|
|
||||||
help: Group or usernames to grant this permission to
|
|
||||||
nargs: "*"
|
|
||||||
metavar: GROUP_OR_USER
|
|
||||||
extra:
|
|
||||||
pattern: *pattern_username
|
|
||||||
-r:
|
|
||||||
full: --remove
|
|
||||||
help: Group or usernames revoke this permission from
|
|
||||||
nargs: "*"
|
|
||||||
metavar: GROUP_OR_USER
|
|
||||||
extra:
|
|
||||||
pattern: *pattern_username
|
|
||||||
-l:
|
-l:
|
||||||
full: --label
|
full: --label
|
||||||
help: Label for this permission. This label will be shown on the SSO and in the admin
|
help: Label for this permission. This label will be shown on the SSO and in the admin
|
||||||
|
@ -343,10 +329,38 @@ user:
|
||||||
- 'True'
|
- 'True'
|
||||||
- 'False'
|
- 'False'
|
||||||
|
|
||||||
|
## user_permission_add()
|
||||||
|
add:
|
||||||
|
action_help: Grant permission to group or user
|
||||||
|
api: PUT /users/permissions/<permission>/add/<names>
|
||||||
|
arguments:
|
||||||
|
permission:
|
||||||
|
help: Permission to manage (e.g. mail or nextcloud or wordpress.editors) (use "yunohost user permission list" and "yunohost user permission -f" to see all the current permissions)
|
||||||
|
names:
|
||||||
|
help: Group or usernames to grant this permission to
|
||||||
|
nargs: "*"
|
||||||
|
metavar: GROUP_OR_USER
|
||||||
|
extra:
|
||||||
|
pattern: *pattern_username
|
||||||
|
|
||||||
|
## user_permission_remove()
|
||||||
|
remove:
|
||||||
|
action_help: Revoke permission to group or user
|
||||||
|
api: PUT /users/permissions/<permission>/remove/<names>
|
||||||
|
arguments:
|
||||||
|
permission:
|
||||||
|
help: Permission to manage (e.g. mail or nextcloud or wordpress.editors) (use "yunohost user permission list" and "yunohost user permission -f" to see all the current permissions)
|
||||||
|
names:
|
||||||
|
help: Group or usernames to revoke this permission to
|
||||||
|
nargs: "*"
|
||||||
|
metavar: GROUP_OR_USER
|
||||||
|
extra:
|
||||||
|
pattern: *pattern_username
|
||||||
|
|
||||||
## user_permission_reset()
|
## user_permission_reset()
|
||||||
reset:
|
reset:
|
||||||
action_help: Reset allowed groups to the default (all_users) for a given permission
|
action_help: Reset allowed groups to the default (all_users) for a given permission
|
||||||
api: DELETE /users/permissions/<app>
|
api: DELETE /users/permissions/<permission>
|
||||||
arguments:
|
arguments:
|
||||||
permission:
|
permission:
|
||||||
help: Permission to manage (e.g. mail or nextcloud or wordpress.editors) (use "yunohost user permission list" and "yunohost user permission -f" to see all the current permissions)
|
help: Permission to manage (e.g. mail or nextcloud or wordpress.editors) (use "yunohost user permission list" and "yunohost user permission -f" to see all the current permissions)
|
||||||
|
|
|
@ -868,18 +868,31 @@ def user_permission_list(short=False, full=False):
|
||||||
return yunohost.permission.user_permission_list(short, full, absolute_urls=True)
|
return yunohost.permission.user_permission_list(short, full, absolute_urls=True)
|
||||||
|
|
||||||
|
|
||||||
def user_permission_update(
|
def user_permission_update(permission, label=None, show_tile=None, sync_perm=True):
|
||||||
permission, add=None, remove=None, label=None, show_tile=None, sync_perm=True
|
import yunohost.permission
|
||||||
|
|
||||||
|
return yunohost.permission.user_permission_update(
|
||||||
|
permission, label=label, show_tile=show_tile, sync_perm=sync_perm
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def user_permission_add(
|
||||||
|
permission, names, protected=None, force=False, sync_perm=True
|
||||||
):
|
):
|
||||||
import yunohost.permission
|
import yunohost.permission
|
||||||
|
|
||||||
return yunohost.permission.user_permission_update(
|
return yunohost.permission.user_permission_update(
|
||||||
permission,
|
permission, add=names, protected=protected, force=force, sync_perm=sync_perm
|
||||||
add=add,
|
)
|
||||||
remove=remove,
|
|
||||||
label=label,
|
|
||||||
show_tile=show_tile,
|
def user_permission_remove(
|
||||||
sync_perm=sync_perm,
|
permission, names, protected=None, force=False, sync_perm=True
|
||||||
|
):
|
||||||
|
import yunohost.permission
|
||||||
|
|
||||||
|
return yunohost.permission.user_permission_update(
|
||||||
|
permission, remove=names, protected=protected, force=force, sync_perm=sync_perm
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue