MCPcopy Create free account
hub / github.com/error311/FileRise / loadFolderPermission

Method loadFolderPermission

src/FileRise/Domain/AuthModel.php:578–594  ·  view source on GitHub ↗

* Loads the folder-only permission for a given user. * * @param string $username * @return bool */

(string $username)

Source from the content-addressed store, hash-verified

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.

Callers

nothing calls this directly

Calls 1

decryptDataFunction · 0.85

Tested by

no test coverage detected