1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/kimai2_ynh.git synced 2024-09-03 19:26:26 +02:00

Implement YunoHost permissions for Kimai Roles

This commit is contained in:
yalh76 2020-04-19 03:48:52 +02:00
parent 0a575071cd
commit 93d65042f8
5 changed files with 15 additions and 17 deletions

View file

@ -139,7 +139,7 @@ kimai:
# The attribute must be given in lowercase!
# The example below uses "posix group style memberUid".
# default: dn
usernameAttribute: cn
usernameAttribute: dn
# Field that holds the group name, which will be used to map the
# LDAP groups with Kimai roles (see groups mapping below).
@ -149,7 +149,7 @@ kimai:
# Field that holds the users dn in your LDAP group definition.
# Value of this configuration is used in the filter (see above).
# default: member
userDnAttribute: groupPermission
userDnAttribute: inheritPermission
# Convert LDAP group name (nameAttribute) to Kimai role
# You will very likely have to define mappings, unless your groups
@ -157,7 +157,6 @@ kimai:
groups:
# - { ldap_value: group1, role: ROLE_TEAMLEAD }
# - { ldap_value: kimai_admin, role: ROLE_ADMIN }
- { ldap_value: "__APP__.main", role: ROLE_USER }
- { ldap_value: "__APP__.teamlead", role: ROLE_TEAMLEAD }
- { ldap_value: "__APP__.admin", role: ROLE_ADMIN }
- { ldap_value: "__APP__.super_admin", role: ROLE_SUPER_ADMIN }

View file

@ -58,7 +58,7 @@
"de": "Ist dies eine öffentliche Applikation?",
"cs": "Je tato aplikace veřejná?"
},
"default": true
"default": false
},
{
"name": "database",

View file

@ -153,9 +153,8 @@ fi
#=================================================
ynh_print_info --message="Building Kimai 2..."
ynh_install_composer --phpversion="7.3" --workdir="$final_path"
ynh_composer_exec --phpversion="7.3" --workdir="$final_path" --commands="install --no-dev --optimize-autoloader"
ynh_composer_exec --phpversion="7.3" --workdir="$final_path" --commands="require zendframework/zend-ldap"
ynh_install_composer --phpversion="7.3" --workdir="$final_path" --install_args="--optimize-autoloader"
ynh_composer_exec --phpversion="7.3" --workdir="$final_path" --commands="require laminas/laminas-ldap"
pushd "$final_path"
php7.3 bin/console kimai:install -n
@ -192,9 +191,8 @@ chown -R $app: $final_path
#=================================================
ynh_print_info --message="Configuring SSOwat..."
ynh_permission_update --permission "main" --add "$admin"
ynh_permission_create --permission="teamlead" --allowed "$admin"
ynh_permission_create --permission="admin" --allowed "$admin"
ynh_permission_create --permission="teamlead"
ynh_permission_create --permission="admin"
ynh_permission_create --permission="super_admin" --allowed "$admin"
# Make app public if necessary

View file

@ -195,9 +195,8 @@ fi
#=================================================
ynh_print_info --message="Upgrading Kimai 2..."
ynh_install_composer --phpversion="7.3" --workdir="$final_path"
ynh_composer_exec --phpversion="7.3" --workdir="$final_path" --commands="install --no-dev --optimize-autoloader"
ynh_composer_exec --phpversion="7.3" --workdir="$final_path" --commands="require zendframework/zend-ldap"
ynh_install_composer --phpversion="7.3" --workdir="$final_path" --install_args="--optimize-autoloader"
ynh_composer_exec --phpversion="7.3" --workdir="$final_path" --commands="require laminas/laminas-ldap"
pushd "$final_path"
php7.3 bin/console kimai:update

View file

@ -24,14 +24,16 @@ ynh_composer_exec () {
# Install and initialize Composer in the given directory
#
# usage: ynh_install_composer --phpversion=phpversion [--workdir=$final_path]
# usage: ynh_install_composer --phpversion=phpversion [--workdir=$final_path] [--install_args="--optimize-autoloader"]
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include
ynh_install_composer () {
# Declare an array to define the options of this helper.
local legacy_args=vw
declare -Ar args_array=( [v]=phpversion= [w]=workdir= )
declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args=)
local phpversion
local workdir
local install_args
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
@ -43,6 +45,6 @@ ynh_install_composer () {
|| ynh_die "Unable to install Composer."
# update dependencies to create composer.lock
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev" \
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|| ynh_die "Unable to update core dependencies with Composer."
}