mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-25 19:28:51 +02:00
Show a notification on homepage and server info page if there is a new version available.
This commit is contained in:
parent
fa4af99525
commit
1fb334b0ca
16 changed files with 1741 additions and 1346 deletions
|
@ -107,6 +107,8 @@ class PermissionPresetsHelper
|
|||
|
||||
//Allow to manage Oauth tokens
|
||||
$this->permissionResolver->setPermission($perm_holder, 'system', 'manage_oauth_tokens', PermissionData::ALLOW);
|
||||
//Allow to show updates
|
||||
$this->permissionResolver->setPermission($perm_holder, 'system', 'show_updates', PermissionData::ALLOW);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace App\Services\UserSystem;
|
|||
use App\Entity\UserSystem\Group;
|
||||
use App\Entity\UserSystem\PermissionData;
|
||||
use App\Entity\UserSystem\User;
|
||||
use App\Helpers\TrinaryLogicHelper;
|
||||
use App\Security\Interfaces\HasPermissionsInterface;
|
||||
|
||||
/**
|
||||
|
@ -138,4 +139,22 @@ class PermissionSchemaUpdater
|
|||
$holder->getPermissions()->removePermission('devices');
|
||||
}
|
||||
}
|
||||
|
||||
private function upgradeSchemaToVersion3(HasPermissionsInterface $holder): void //@phpstan-ignore-line This is called via reflection
|
||||
{
|
||||
$permissions = $holder->getPermissions();
|
||||
|
||||
//If the system.show_updates permission is not defined yet, set it to true, if the user can view server info, server logs or edit users or groups
|
||||
if (!$permissions->isPermissionSet('system', 'show_updates')) {
|
||||
|
||||
$new_value = TrinaryLogicHelper::or(
|
||||
$permissions->getPermissionValue('system', 'server_infos'),
|
||||
$permissions->getPermissionValue('system', 'show_logs'),
|
||||
$permissions->getPermissionValue('users', 'edit'),
|
||||
$permissions->getPermissionValue('groups', 'edit')
|
||||
);
|
||||
|
||||
$permissions->setPermissionValue('system', 'show_updates', $new_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue