]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/commitdiff
Fix Role Editor: make the role stuff db-independent (most code already was).
authorBram Matthys <redacted>
Sun, 7 May 2023 17:24:45 +0000 (19:24 +0200)
committerBram Matthys <redacted>
Sun, 7 May 2023 17:24:45 +0000 (19:24 +0200)
Get rid of the ROLE hooks at the same time, since they can all be accessed
via the generic config API, right ?

Classes/class-hook.php
Classes/class-paneluser.php
plugins/sql_db/sql_db.php

index c26bff2fa082fea6bad16f0323e0a9a829ab36f1..0ec4cfafab5ee0b884c56074ac733543db9067bc 100644 (file)
@@ -133,14 +133,6 @@ define('HOOKTYPE_USER_PERMISSION_LIST', 116);
 
 define('HOOKTYPE_EDIT_USER', 117);
 
-define('HOOKTYPE_USER_ROLE_LIST', 118);
-
-define('HOOKTYPE_EDIT_ROLE', 119);
-
-define('HOOKTYPE_ADD_ROLE', 120);
-
-define('HOOKTYPE_DEL_ROLE', 121);
-
 define('HOOKTYPE_AUTH_MOD', 200);
 
 /** An upgrade has been detected.
index 9d11d99b3c238adca956b3ca89274c2082a15a25..810aac51748f687ef364c5fbbacc4944ba21efe4 100644 (file)
@@ -371,13 +371,18 @@ function generate_panel_user_permission_table($user)
 
 function get_panel_user_roles_list()
 {
+       GLOBAL $config;
+
        /* Defaults */
        $list = [
-        "Super-Admin" => get_panel_user_permission_list(), // SuperAdmin can do everything
-        "Read-Only" => [], // Read Only can do nothing
+               "Super-Admin" => get_panel_user_permission_list(), // SuperAdmin can do everything
+               "Read-Only" => [], // Read Only can do nothing
        ];
 
-       Hook::run(HOOKTYPE_USER_ROLE_LIST, $list);
+       if (isset($config["user_roles"]))
+               foreach($config['user_roles'] as $r => $role)
+                       $list[$r] = $role;
+
        return $list;
 }
 
index 56de95953a8ce860c7ef79ae7d1216cb29da0ac4..a6f3cffd59ccb6632b3eb13458e3b6d91ee02799 100644 (file)
@@ -23,18 +23,9 @@ class sql_db
                Hook::func(HOOKTYPE_EDIT_USER, 'sql_db::edit_core');
                Hook::func(HOOKTYPE_PRE_OVERVIEW_CARD, 'sql_db::add_pre_overview_card');
                Hook::func(HOOKTYPE_UPGRADE, 'sql_db::create_tables'); // handles upgrades too ;)
-               Hook::func(HOOKTYPE_USER_ROLE_LIST, 'sql_db::roles_list');
                AuthModLoaded::$status = 1;
        }
 
-       public static function roles_list(&$list)
-       {
-               $settings = DbSettings::get();
-               if (isset($settings['user_roles']))
-                       foreach($settings['user_roles'] as $r => $role)
-                               $list[$r] = $role;
-       }
-
        public static function add_pre_overview_card($empty)
        {
                if (defined('SQL_DEFAULT_USER'))