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

Function getUserGrants

public/js/adminFolderAccess.js:230–240  ·  view source on GitHub ↗
(username, sourceId = "")

Source from the content-addressed store, hash-verified

228}
229
230async function getUserGrants(username, sourceId = "") {
231 const key = sourceId || getFolderAccessSourceId() || '';
232 const url = `/api/admin/acl/getGrants.php?user=${encodeURIComponent(username)}`
233 + (key ? `&sourceId=${encodeURIComponent(key)}` : '');
234 const res = await fetch(url, {
235 credentials: 'include'
236 });
237 const data = await safeJson(res).catch(() => ({}));
238 const grants = (data && data.grants) ? data.grants : {};
239 return (grants && typeof grants === 'object' && !Array.isArray(grants)) ? grants : {};
240}
241
242function renderFolderGrantsUI(principal, container, folders, grants) {
243 if (!Array.isArray(folders) || !container) return;

Callers 2

ensureLoadedFunction · 0.85
ensureLoadedFunction · 0.85

Calls 2

getFolderAccessSourceIdFunction · 0.85
safeJsonFunction · 0.70

Tested by

no test coverage detected