roles guard + docs + logo

This commit is contained in:
Thanakorn S
2026-05-06 16:37:20 +07:00
parent 797dee5d17
commit 2eb6a1a315
60 changed files with 496 additions and 105 deletions
+23 -1
View File
@@ -785,4 +785,26 @@ function set_btn_state(selector, enabled, hint) {
.prop('disabled', true)
.attr('title', hint || '');
}
}
}
var ROLE_RANK = { viewer: 0, staff: 1, admin: 2, owner: 3 };
function apply_role_ui() {
var role = document.getElementById('session-context')?.dataset.role || 'viewer';
var rank = ROLE_RANK[role] ?? 0;
$('[data-min-role]').each(function() {
var required = ROLE_RANK[$(this).data('min-role')] ?? 99;
if (rank < required) $(this).hide();
});
}
$(function() {
apply_role_ui();
if (window.MutationObserver) {
var roleObserver = new MutationObserver(function() {
apply_role_ui();
});
roleObserver.observe(document.body, { childList: true, subtree: true });
}
});