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

Function openUserPermissionsModal

public/js/adminFolderAccess.js:1064–1169  ·  view source on GitHub ↗
(initialUser = null)

Source from the content-addressed store, hash-verified

1062}
1063
1064export function openUserPermissionsModal(initialUser = null) {
1065 let userPermissionsModal = document.getElementById("userPermissionsModal");
1066 const isDarkMode = document.body.classList.contains("dark-mode");
1067 const overlayBackground = isDarkMode ? "rgba(0,0,0,0.7)" : "rgba(0,0,0,0.3)";
1068 const modalContentStyles = `
1069 background: ${isDarkMode ? "#2c2c2c" : "#fff"};
1070 color: ${isDarkMode ? "#e0e0e0" : "#000"};
1071 padding: 20px;
1072 width: clamp(980px, 92vw, 1280px);
1073 max-width: none;
1074 position: relative;
1075 max-height: 90vh;
1076 overflow: auto;
1077`;
1078
1079 if (!userPermissionsModal) {
1080 userPermissionsModal = document.createElement("div");
1081 userPermissionsModal.id = "userPermissionsModal";
1082 userPermissionsModal.style.cssText = `
1083 position: fixed;
1084 top: 0; left: 0; width: 100vw; height: 100vh;
1085 background-color: ${overlayBackground};
1086 display: flex; justify-content: center; align-items: center;
1087 z-index: 10000;
1088 `;
1089 userPermissionsModal.innerHTML = `
1090 <div class="modal-content" style="${modalContentStyles}">
1091 <span id="closeUserPermissionsModal" class="editor-close-btn">&times;</span>
1092 <h3>${tf("folder_access", "Folder Access")}</h3>
1093 <div class="modal-source-row" id="folderAccessSourceRow" style="display:none;">
1094 <label for="folderAccessSourceSelect">${tf("storage_source", "Source")}</label>
1095 <select id="folderAccessSourceSelect" class="form-control form-control-sm"></select>
1096 </div>
1097 <div class="muted" style="margin:-4px 0 10px;">
1098 <span class="grant-help-short">${tf("grant_folders_help_short", "Per-folder access. Create is file-only; subfolders need Manage/Ownership. Share Folder needs Manage + View (all).")}</span>
1099 <button type="button" class="btn btn-link btn-sm p-0 grant-help-toggle" aria-expanded="false" style="margin-left:6px;">
1100 ${tf("help_more", "More")}
1101 </button>
1102 <span class="grant-help-full" style="display:none;">
1103 ${tf("grant_folders_help", "Grant per-folder capabilities to each user. View (all) shows all contents; View (own) shows only the user's uploads. Write is file-level ops (upload/edit/rename/copy/delete/extract). Create is file-only; subfolders require Manage/Ownership. Manage/Ownership enables folder actions (create/rename/move/delete, grant access) and implies View (all), Write, and Share. Share File auto-enables View (own); Share Folder requires Manage/Ownership + View (all).")}
1104 </span>
1105 </div>
1106 <div id="userPermissionsList" style="max-height: 82vh; min-height: 420px; overflow-y: auto; margin-bottom: 15px;">
1107 </div>
1108 <div style="display: flex; justify-content: flex-end; gap: 10px;">
1109 <button type="button" id="cancelUserPermissionsBtn" class="btn btn-secondary">${t("cancel")}</button>
1110 <button type="button" id="saveUserPermissionsBtn" class="btn btn-primary">${t("save_permissions")}</button>
1111 </div>
1112 </div>
1113 `;
1114 document.body.appendChild(userPermissionsModal);
1115 document.getElementById("closeUserPermissionsModal").addEventListener("click", () => {
1116 userPermissionsModal.style.display = "none";
1117 });
1118 document.getElementById("cancelUserPermissionsBtn").addEventListener("click", () => {
1119 userPermissionsModal.style.display = "none";
1120 });
1121 document.getElementById("saveUserPermissionsBtn").addEventListener("click", async () => {

Callers 1

openAdminPanelFunction · 0.85

Calls 8

tFunction · 0.85
collectGrantsFromFunction · 0.85
getFolderAccessSourceIdFunction · 0.85
tfFunction · 0.70
showToastFunction · 0.70
sendRequestFunction · 0.70
loadUserPermissionsListFunction · 0.70

Tested by

no test coverage detected