Przeglądaj źródła

Add "Tests" icon for tester managers

Alan Lam 6 lat temu
rodzic
commit
8115a297fb
3 zmienionych plików z 8 dodań i 4 usunięć
  1. 1 1
      controllers/account.php
  2. 1 1
      controllers/tests.php
  3. 6 2
      engine/user.php

+ 1 - 1
controllers/account.php

@@ -133,7 +133,7 @@ if($user->canAccessTests()) {
 	$tests = $user->getPendingTests();
 	$tests_remaining = count($tests);
 
-	$tests_url = $user->isAdmin() ? "/account/tests?custom=overdue_test" : "/account/tests";
+	$tests_url = $user->isTesterManager() ? "/account/tests?custom=overdue_test" : "/account/tests";
 	$tests_icon = new AccountIcon(__("Tests"), $tests_url, "clipboard-check");
 	$tests_icon->setCounter($tests_remaining);
 

+ 1 - 1
controllers/tests.php

@@ -7,7 +7,7 @@ Core::addBreadcrumb("/account/tests", $page_title);
 
 $user = Core::$user;
 
-// Admin / Super Admin
+// Admin / Super Admin / Tester Manager
 if($user->canAccessAdminTestsList()) {
 	require "tests_admin_list.php";
 }

+ 6 - 2
engine/user.php

@@ -382,6 +382,10 @@ class User extends Model {
 		}
 	}
 
+	public function isTesterManager(): bool {
+		return $this->level >= User::LEVEL_TESTER_MANAGER;
+	}
+
 	public function isAdmin(): bool {
 		return $this->level >= User::LEVEL_ADMIN;
 	}
@@ -706,7 +710,7 @@ class User extends Model {
 	}
 
 	public function canAccessTests(): bool {
-		return $this->isTester() || $this->isAdmin();
+		return $this->isTester() || $this->isTesterManager();
 	}
 
 	public function canAccessPractice(): bool {
@@ -734,7 +738,7 @@ class User extends Model {
 	}
 
 	public function canAccessAdminTestsList(): bool {
-		return $this->level >= User::LEVEL_TESTER_MANAGER;
+		return $this->isTesterManager();
 	}
 
 	public function canExportProjectCsv(): bool {