1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-06 12:02:45 +03:00

Aligned logic to entity_permission role_id usage change

Now idenitifies fallback using role_id and user_id = null.
Lays some foundations for handling user_id.
This commit is contained in:
Dan Brown
2022-12-07 22:07:03 +00:00
parent 1c53ffc4d1
commit f8c4725166
11 changed files with 129 additions and 59 deletions

View File

@@ -28,7 +28,7 @@ export class EntityPermissions extends Component {
// Remove role row button click
this.container.addEventListener('click', event => {
const button = event.target.closest('button');
if (button && button.dataset.roleId) {
if (button && button.dataset.modelType) {
this.removeRowOnButtonClick(button)
}
});
@@ -61,14 +61,18 @@ export class EntityPermissions extends Component {
removeRowOnButtonClick(button) {
const row = button.closest('.item-list-row');
const roleId = button.dataset.roleId;
const roleName = button.dataset.roleName;
const modelId = button.dataset.modelId;
const modelName = button.dataset.modelName;
const modelType = button.dataset.modelType;
const option = document.createElement('option');
option.value = roleId;
option.textContent = roleName;
option.value = modelId;
option.textContent = modelName;
this.roleSelect.append(option);
if (modelType === 'role') {
this.roleSelect.append(option);
}
// TODO - User role!
row.remove();
}