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

Function getAllFolders

public/js/adminFolderAccess.js:205–228  ·  view source on GitHub ↗
(force = false, sourceId = "")

Source from the content-addressed store, hash-verified

203let __allFoldersCache = new Map();
204
205async function getAllFolders(force = false, sourceId = "") {
206 const key = sourceId || getFolderAccessSourceId() || '';
207 if (!force && __allFoldersCache.has(key)) return __allFoldersCache.get(key).slice();
208
209 const url = '/api/folder/getFolderList.php?counts=0&ts=' + Date.now()
210 + (key ? `&sourceId=${encodeURIComponent(key)}` : '');
211 const res = await fetch(url, {
212 credentials: 'include',
213 cache: 'no-store',
214 headers: { 'Cache-Control': 'no-store' }
215 });
216 const data = await safeJson(res).catch(() => []);
217 const list = Array.isArray(data)
218 ? data.map(x => (typeof x === 'string' ? x : x.folder)).filter(Boolean)
219 : [];
220
221 const hidden = new Set(['profile_pics', 'trash']);
222 const cleaned = list
223 .filter(f => f && !hidden.has(f.toLowerCase()))
224 .sort((a, b) => (a === 'root' ? -1 : b === 'root' ? 1 : a.localeCompare(b)));
225
226 __allFoldersCache.set(key, cleaned);
227 return cleaned.slice();
228}
229
230async function getUserGrants(username, sourceId = "") {
231 const key = sourceId || getFolderAccessSourceId() || '';

Callers 3

loadUserPermissionsListFunction · 0.85
loadUserPermissionsListFunction · 0.85
renderGroupAclFunction · 0.85

Calls 4

getFolderAccessSourceIdFunction · 0.85
setMethod · 0.80
safeJsonFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected