fix chech rights on startup

This commit is contained in:
test
2026-08-31 08:20:18 +02:00
parent 7bf4fb14f9
commit c88decaf42
3 changed files with 16 additions and 9 deletions
+1 -1
View File
@@ -443,7 +443,7 @@ class AssetTab extends CommonDBTM
): void {
echo "<div class='plugin-urbackup-inner-tabs'>";
$canWrite = Session::haveRight(self::$rightname, UPDATE) || Session::haveRight(self::$rightname, CREATE);
$canWrite = Profile::canCurrentUser(UPDATE) || Profile::canCurrentUser(CREATE);
echo '<ul class="nav nav-tabs" id="urbackupTabs" role="tablist">';
echo '<li class="nav-item" role="presentation">';
+5 -5
View File
@@ -305,7 +305,7 @@ class Server extends CommonDBTM
'datatype' => 'datetime',
];
if (Session::haveRight(self::$rightname, UPDATE)) {
if (Profile::canCurrentUser(UPDATE)) {
$tab[] = [
'id' => 14,
'table' => self::getTable(),
@@ -445,8 +445,8 @@ class Server extends CommonDBTM
echo "</tr>";
$canEdit = $ID > 0
? Session::haveRight(self::$rightname, UPDATE)
: Session::haveRight(self::$rightname, CREATE);
? Profile::canCurrentUser(UPDATE)
: Profile::canCurrentUser(CREATE);
echo "<tr class='tab_bg_1'>";
echo "<td>" . htmlspecialchars(__('API username', 'urbackup')) . "</td>";
@@ -1152,7 +1152,7 @@ class Server extends CommonDBTM
}
}
$canWrite = Session::haveRight(self::$rightname, UPDATE) || Session::haveRight(self::$rightname, CREATE);
$canWrite = Profile::canCurrentUser(UPDATE) || Profile::canCurrentUser(CREATE);
echo '<table class="table table-striped table-hover">';
echo '<thead>';
@@ -1219,7 +1219,7 @@ class Server extends CommonDBTM
{
global $DB;
$canWrite = Session::haveRight(self::$rightname, UPDATE) || Session::haveRight(self::$rightname, CREATE);
$canWrite = Profile::canCurrentUser(UPDATE) || Profile::canCurrentUser(CREATE);
$apiStatus = (int) ($server->fields['last_api_status'] ?? 0);
if ($apiStatus !== 1) {