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

Method explicitAll

src/FileRise/Support/ACL.php:1105–1156  ·  view source on GitHub ↗

New: full explicit including granular

(string $folder)

Source from the content-addressed store, hash-verified

1103
1104 // New: full explicit including granular
1105 public static function explicitAll(string $folder): array
1106 {
1107 $folder = self::normalizeFolder($folder);
1108 $acl = self::$cache ?? self::loadFresh();
1109 $rec = $acl['folders'][$folder] ?? [];
1110 $norm = function ($v): array {
1111 if (!is_array($v)) {
1112 return [];
1113 }
1114 $v = array_map('strval', $v);
1115 return array_values(array_unique($v));
1116 };
1117 $inheritMap = [];
1118 if (isset($rec['inherit']) && is_array($rec['inherit'])) {
1119 foreach ($rec['inherit'] as $k => $v) {
1120 $key = is_int($k) ? (string)$v : (string)$k;
1121 if ($key === '') {
1122 continue;
1123 }
1124 $inheritMap[$key] = (bool)$v;
1125 }
1126 }
1127 $explicitMap = [];
1128 if (isset($rec['explicit']) && is_array($rec['explicit'])) {
1129 foreach ($rec['explicit'] as $k => $v) {
1130 $key = is_int($k) ? (string)$v : (string)$k;
1131 if ($key === '') {
1132 continue;
1133 }
1134 $explicitMap[$key] = (bool)$v;
1135 }
1136 }
1137 return [
1138 'owners' => $norm($rec['owners'] ?? []),
1139 'read' => $norm($rec['read'] ?? []),
1140 'write' => $norm($rec['write'] ?? []),
1141 'share' => $norm($rec['share'] ?? []),
1142 'read_own' => $norm($rec['read_own'] ?? []),
1143 'create' => $norm($rec['create'] ?? []),
1144 'upload' => $norm($rec['upload'] ?? []),
1145 'edit' => $norm($rec['edit'] ?? []),
1146 'rename' => $norm($rec['rename'] ?? []),
1147 'copy' => $norm($rec['copy'] ?? []),
1148 'move' => $norm($rec['move'] ?? []),
1149 'delete' => $norm($rec['delete'] ?? []),
1150 'extract' => $norm($rec['extract'] ?? []),
1151 'share_file' => $norm($rec['share_file'] ?? []),
1152 'share_folder' => $norm($rec['share_folder'] ?? []),
1153 'inherit' => $inheritMap,
1154 'explicit' => $explicitMap,
1155 ];
1156 }
1157
1158 public static function upsert(string $folder, array $owners, array $read, array $write, array $share): bool
1159 {

Callers 1

getUserGrantsMethod · 0.80

Calls 2

normalizeFolderMethod · 0.95
loadFreshMethod · 0.95

Tested by

no test coverage detected