define('PERMISSION_SPAMFILTER_DEL', 'sf_del');
/** Can rehash servers */
define('PERMISSION_REHASH', 'rhs');
+/** Can install and uninstall plugins */
+define('PERMISSION_MANAGE_PLUGINS', 'mng_plg');
/**
* PanelUser
* This is the User class for the SQL_Auth plugin
/**
* Add user meta data
- * You may use arrays or strings but both parameter types must match
+ * If using an array for the first param then you
+ * must also use an array for the second param
* @param array|string $key
- * @param array|string $value
+ * @param array|string|int|bool|null $value
*/
- function add_meta(array|string $key, array|string $value)
+ function add_meta(array|string $key, array|string|int|bool|null $value)
{
- if (!$key || !$value)
+ if (!$key)
return false;
- if (is_string($key) && is_string($value))
- $arr[$key] = $value;
-
- else
+ if (is_array($key))
+ {
foreach ($key as $i => $k)
$arr[$k] = $value[$i];
-
+ } else {
+ $arr[$key] = $value;
+ }
+
foreach($arr as $k => $v)
{
$meta = [
{
$list = [
"Can add/delete/edit Admin Panel users" => PERMISSION_MANAGE_USERS,
+ "Can add/delete/manage plugins" => PERMISSION_MANAGE_PLUGINS,
"Can ban/kill IRC users" => PERMISSION_BAN_USERS,
"Can change properties of a user, i.e. vhost, modes and more" => PERMISSION_EDIT_USER,
"Can change properties of a channel, i.e. topic, modes and more" => PERMISSION_EDIT_CHANNEL,
"Can remove server ban exceptions" => PERMISSION_BAN_EXCEPTION_DEL,
"Can add Spamfilter entries" => PERMISSION_SPAMFILTER_ADD,
"Can remove Spamfilter entries" => PERMISSION_SPAMFILTER_DEL
+
];
Hook::run(HOOKTYPE_USER_PERMISSION_LIST, $list); // so plugin writers can add their own permissions
return $list;