From b839e82599277d8ec329e5c01413ddcc23d629e6 Mon Sep 17 00:00:00 2001 From: Kay0u Date: Mon, 10 Jan 2022 11:18:31 +0100 Subject: [PATCH] Add info in the config panel --- conf/class.auth.ldap.php | 58 ++++++++++++++++++++-------------------- config_panel.toml | 16 +---------- 2 files changed, 30 insertions(+), 44 deletions(-) diff --git a/conf/class.auth.ldap.php b/conf/class.auth.ldap.php index 851bff1..bb7b016 100644 --- a/conf/class.auth.ldap.php +++ b/conf/class.auth.ldap.php @@ -70,38 +70,38 @@ class ldapDcAuth extends dcAuth $cur->user_tz = 'Europe/Paris'; # Can change this, PR are welcome $cur->user_default_blog = 'default'; # Can change this, PR are welcome $this->sudo(array($this->core,'addUser'), $cur); - } - # Possible roles: - # admin "administrator" - # contentadmin "manage all entries and comments" - # usage "manage their own entries and comments" - # publish "publish entries and comments" - # delete "delete entries and comments" - # categories "manage categories" - # media_admin "manage all media items" - # media "manage their own media items" - # pages "manage pages" - # blogroll "manage blogroll" - $permissions = array( - 'admin' => "__BLOG_ADMIN__", - 'contentadmin' => "__BLOG_CONTENTADMIN__", - 'usage' => "__BLOG_USAGE__", - 'publish' => "__BLOG_PUBLISH__", - 'delete' => "__BLOG_DELETE__", - 'categories' => "__BLOG_CATEGORIES__", - 'media_admin' => "__BLOG_MEDIA_ADMIN__", - 'media' => "__BLOG_MEDIA__", - 'pages' => "__BLOG_PAGES__", - 'blogroll' => "__BLOG_BLOGROLL__", - ); - $set_perms = []; + # Possible roles: + # admin "administrator" + # contentadmin "manage all entries and comments" + # usage "manage their own entries and comments" + # publish "publish entries and comments" + # delete "delete entries and comments" + # categories "manage categories" + # media_admin "manage all media items" + # media "manage their own media items" + # pages "manage pages" + # blogroll "manage blogroll" + $permissions = array( + 'admin' => "__BLOG_ADMIN__", + 'contentadmin' => "__BLOG_CONTENTADMIN__", + 'usage' => "__BLOG_USAGE__", + 'publish' => "__BLOG_PUBLISH__", + 'delete' => "__BLOG_DELETE__", + 'categories' => "__BLOG_CATEGORIES__", + 'media_admin' => "__BLOG_MEDIA_ADMIN__", + 'media' => "__BLOG_MEDIA__", + 'pages' => "__BLOG_PAGES__", + 'blogroll' => "__BLOG_BLOGROLL__", + ); + $set_perms = []; - foreach ($permissions as $perm_id => $v) { - if (is_string($v) && $v == "true") { - $set_perms[$perm_id] = true; + foreach ($permissions as $perm_id => $v) { + if (is_string($v) && $v == "true") { + $set_perms[$perm_id] = true; + } } + $this->sudo(array($this->core, 'setUserBlogPermissions'), $user_id, 'default', $set_perms, true); } - $this->sudo(array($this->core, 'setUserBlogPermissions'), $user_id, 'default', $set_perms, true); $this->con->commit(); } diff --git a/config_panel.toml b/config_panel.toml index aa5e3b9..1733d40 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -13,6 +13,7 @@ name = "Dotclear2 configuration" [ynh_users] name = "Yunohost users" +help = "These permissions apply to the first connection of the user, the super user can change them in dotclear." [ynh_users.main_permission] name = "Permissions for YunoHost users" @@ -102,18 +103,3 @@ name = "Yunohost users" yes = "true" no = "false" bind = "'blogroll':__FINALPATH__/inc/class.auth.ldap.php" - - - - - -# admin "administrator" -# contentadmin "manage all entries and comments" -# usage "manage their own entries and comments" -# publish "publish entries and comments" -# delete "delete entries and comments" -# categories "manage categories" -# media_admin "manage all media items" -# media "manage their own media items" -# pages "manage pages" -# blogroll "manage blogroll" \ No newline at end of file