feat: 完成 issue #151 用户/角色管理页补充角色权限矩阵视图(PRD 5.7)
This commit is contained in:
@@ -117,5 +117,31 @@
|
||||
};
|
||||
|
||||
renderUsers();
|
||||
renderPermMatrix();
|
||||
});
|
||||
|
||||
/* 角色权限矩阵展示(issue #151 验收:矩阵生效可见;与 studio 门控同源) */
|
||||
var PERM_MATRIX = {
|
||||
readonly: { view: true, edit: false, publish: false, manage: false },
|
||||
engineer: { view: true, edit: true, publish: false, manage: false },
|
||||
admin: { view: true, edit: true, publish: true, manage: true }
|
||||
};
|
||||
function renderPermMatrix() {
|
||||
var tbody = document.querySelector("#perm-matrix tbody");
|
||||
tbody.innerHTML = "";
|
||||
UserStore.ROLES.forEach(function (r) {
|
||||
var tr = document.createElement("tr");
|
||||
var td = document.createElement("td");
|
||||
td.textContent = UserStore.ROLE_LABELS[r];
|
||||
td.className = "role-" + r;
|
||||
tr.appendChild(td);
|
||||
["view", "edit", "publish", "manage"].forEach(function (a) {
|
||||
var c = document.createElement("td");
|
||||
c.textContent = PERM_MATRIX[r][a] ? "✓" : "✗";
|
||||
c.style.color = PERM_MATRIX[r][a] ? "#2ecc71" : "#64748b";
|
||||
tr.appendChild(c);
|
||||
});
|
||||
tbody.appendChild(tr);
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user