* Loads the folder-only permission for a given user. * * @param string $username * @return bool */
(string $username)
| 576 | * @return bool |
| 577 | */ |
| 578 | public static function loadFolderPermission(string $username): bool |
| 579 | { |
| 580 | $permissionsFile = USERS_DIR . 'userPermissions.json'; |
| 581 | if (file_exists($permissionsFile)) { |
| 582 | $content = file_get_contents($permissionsFile); |
| 583 | $decrypted = decryptData($content, $GLOBALS['encryptionKey']); |
| 584 | $permissions = $decrypted !== false ? json_decode($decrypted, true) : json_decode($content, true); |
| 585 | if (is_array($permissions)) { |
| 586 | foreach ($permissions as $storedUsername => $data) { |
| 587 | if (strcasecmp($storedUsername, $username) === 0 && isset($data['folderOnly'])) { |
| 588 | return (bool)$data['folderOnly']; |
| 589 | } |
| 590 | } |
| 591 | } |
| 592 | } |
| 593 | return false; |
| 594 | } |
| 595 | |
| 596 | /** |
| 597 | * Validate a remember-me token and return its stored payload. |
nothing calls this directly
no test coverage detected