mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
permission_update -> permission_urls (+ tweak the helper name) so that it's more differentiable from user_permission_update
This commit is contained in:
parent
f60af2053f
commit
a6d68c76c4
2 changed files with 21 additions and 7 deletions
|
@ -268,18 +268,18 @@ ynh_permission_remove() {
|
||||||
|
|
||||||
# Add a path managed by the SSO
|
# Add a path managed by the SSO
|
||||||
#
|
#
|
||||||
# usage: ynh_permission_add_path --app "app" --permission "permission" --url "url" ["url" ...]
|
# usage: ynh_permission_add_url --app "app" --permission "permission" --url "url" ["url" ...]
|
||||||
# | arg: app - the application id
|
# | arg: app - the application id
|
||||||
# | arg: permission - the name for the permission
|
# | arg: permission - the name for the permission
|
||||||
# | arg: url - the FULL url for the the permission (ex domain.tld/apps/admin)
|
# | arg: url - the FULL url for the the permission (ex domain.tld/apps/admin)
|
||||||
ynh_permission_add_path() {
|
ynh_permission_add_url() {
|
||||||
declare -Ar args_array=( [a]=app= [p]=permission= [u]=url= )
|
declare -Ar args_array=( [a]=app= [p]=permission= [u]=url= )
|
||||||
local app
|
local app
|
||||||
local permission
|
local permission
|
||||||
local url
|
local url
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
yunohost tools shell -c "from yunohost.permission import permission_update; permission_update('$app', '$permission', add_url=['${url//';'/"','"}'], sync_perm=False)"
|
yunohost tools shell -c "from yunohost.permission import permission_urls; permission_urls('$app', '$permission', add_url=['${url//';'/"','"}'], sync_perm=False)"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove a path managed by the SSO
|
# Remove a path managed by the SSO
|
||||||
|
@ -288,12 +288,12 @@ ynh_permission_add_path() {
|
||||||
# | arg: app - the application id
|
# | arg: app - the application id
|
||||||
# | arg: permission - the name for the permission
|
# | arg: permission - the name for the permission
|
||||||
# | arg: url - the FULL url for the the permission (ex domain.tld/apps/admin)
|
# | arg: url - the FULL url for the the permission (ex domain.tld/apps/admin)
|
||||||
ynh_permission_del_path() {
|
ynh_permission_remove_url() {
|
||||||
declare -Ar args_array=( [a]=app= [p]=permission= [u]=url= )
|
declare -Ar args_array=( [a]=app= [p]=permission= [u]=url= )
|
||||||
local app
|
local app
|
||||||
local permission
|
local permission
|
||||||
local url
|
local url
|
||||||
ynh_handle_getopts_args "$@"
|
ynh_handle_getopts_args "$@"
|
||||||
|
|
||||||
yunohost tools shell -c "from yunohost.permission import permission_update; permission_update('$app', '$permission', remove_url=['${url//';'/"','"}'], sync_perm=False)"
|
yunohost tools shell -c "from yunohost.permission import permission_urls; permission_urls('$app', '$permission', remove_url=['${url//';'/"','"}'], sync_perm=False)"
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,12 @@ from yunohost.log import is_unit_operation
|
||||||
|
|
||||||
logger = getActionLogger('yunohost.user')
|
logger = getActionLogger('yunohost.user')
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# The followings are the methods exposed through the "yunohost user permission" interface
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
def user_permission_list(app=None, permission=None, username=None, group=None):
|
def user_permission_list(app=None, permission=None, username=None, group=None):
|
||||||
"""
|
"""
|
||||||
|
@ -315,6 +321,14 @@ def user_permission_clear(operation_logger, app=[], permission=None, sync_perm=T
|
||||||
|
|
||||||
return user_permission_list(app, permission)
|
return user_permission_list(app, permission)
|
||||||
|
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# The followings methods are *not* directly exposed.
|
||||||
|
# They are used to create/delete the permissions (e.g. during app install/remove)
|
||||||
|
# and by some app helpers to possibly add additional permissions and tweak the urls
|
||||||
|
#
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
@is_unit_operation(['permission', 'app'])
|
@is_unit_operation(['permission', 'app'])
|
||||||
def permission_create(operation_logger, app, permission, urls=None, default_allow=True, sync_perm=True):
|
def permission_create(operation_logger, app, permission, urls=None, default_allow=True, sync_perm=True):
|
||||||
|
@ -374,9 +388,9 @@ def permission_create(operation_logger, app, permission, urls=None, default_allo
|
||||||
|
|
||||||
|
|
||||||
@is_unit_operation(['permission', 'app'])
|
@is_unit_operation(['permission', 'app'])
|
||||||
def permission_update(operation_logger, app, permission, add_url=None, remove_url=None, sync_perm=True):
|
def permission_urls(operation_logger, app, permission, add_url=None, remove_url=None, sync_perm=True):
|
||||||
"""
|
"""
|
||||||
Update a permission for a specific application
|
Update urls related to a permission for a specific application
|
||||||
|
|
||||||
Keyword argument:
|
Keyword argument:
|
||||||
app -- an application OR sftp, xmpp (metronome), mail
|
app -- an application OR sftp, xmpp (metronome), mail
|
||||||
|
|
Loading…
Add table
Reference in a new issue