Refactoring user permissions

This commit is contained in:
xiaomlove
2022-08-20 19:11:28 +08:00
parent 3046837576
commit b79762686a
73 changed files with 945 additions and 326 deletions
+1
View File
@@ -174,6 +174,7 @@ return array (
'userbar' => '2',
'view_special_torrent' => '4',
'torrent_hr' => User::CLASS_ADMINISTRATOR,
'torrent-approval' => User::CLASS_ADMINISTRATOR,
),
'tweak' =>
array (
+11
View File
@@ -25,4 +25,15 @@ abstract class BasePlugin extends BaseRepository
Artisan::call($toExecute);
}
}
public function checkMainApplicationVersion()
{
$constantName = "static::COMPATIBLE_VERSION";
if (defined($constantName) && version_compare(VERSION_NUMBER, constant($constantName), '<')) {
throw new \RuntimeException(sprintf(
"NexusPHP version: %s is too low, this plugin require: %s",
VERSION_NUMBER, constant($constantName)
));
}
}
}
+2 -2
View File
@@ -38,7 +38,7 @@ class Hook
$args = func_get_args();
ksort(self::$callbacks[$name]);
reset(self::$callbacks[$name]);
do_log("name: $name, argc: " . (func_num_args() - 1));
// do_log("name: $name, argc: " . (func_num_args() - 1));
do {
foreach ((array)current(self::$callbacks[$name]) as $id => $callback) {
$args[1] = $value;
@@ -65,7 +65,7 @@ class Hook
$args = func_get_args();
ksort(self::$callbacks[$name]);
reset(self::$callbacks[$name]);
do_log("name: $name, argc: " . (func_num_args() - 1));
// do_log("name: $name, argc: " . (func_num_args() - 1));
do {
foreach ((array)current(self::$callbacks[$name]) as $id => $callback) {
// do_log("name: $name, id: $id, before, params: " . nexus_json_encode(array_slice($args, 1, $callback['argc'])));