mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +01:00
Admin: Group action to add / remove application run rights
This commit is contained in:
parent
ba04abd1b4
commit
8544a807e3
@ -260,6 +260,13 @@ class admin_ui
|
||||
'group' => 2,
|
||||
'allowOnMultiple' => false
|
||||
),
|
||||
'run_rights' => array(
|
||||
'onExecute' => 'javaScript:app.admin.group_run_rights',
|
||||
'caption' => 'Run rights for applications',
|
||||
'icon' => 'lock',
|
||||
'group' => 2,
|
||||
'allowOnMultiple' => true
|
||||
)
|
||||
);
|
||||
if (!$GLOBALS['egw']->acl->check('account_access',64,'admin')) // no rights to set ACL-rights
|
||||
{
|
||||
|
@ -20,7 +20,10 @@ import {egwAction, egwActionObject} from '../../api/js/egw_action/egw_action';
|
||||
import {LitElement} from "@lion/core";
|
||||
import {et2_nextmatch} from "../../api/js/etemplate/et2_extension_nextmatch";
|
||||
import {et2_DOMWidget} from "../../api/js/etemplate/et2_core_DOMWidget";
|
||||
import {Et2SelectAccount} from "../../api/js/etemplate/Et2Select/Et2SelectAccount";
|
||||
import {Et2SelectAccount} from "../../api/js/etemplate/Et2Select/Select/Et2SelectAccount";
|
||||
import {EgwAction} from "../../api/js/egw_action/EgwAction";
|
||||
import {EgwActionObject} from "../../api/js/egw_action/EgwActionObject";
|
||||
import type {Et2Button} from "../../api/js/etemplate/Et2Button/Et2Button";
|
||||
|
||||
/**
|
||||
* UI for Admin
|
||||
@ -550,6 +553,61 @@ class AdminApp extends EgwApp
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a dialog to add / remove application run rights for one or more groups
|
||||
*
|
||||
* @param _action
|
||||
* @param _senders
|
||||
*/
|
||||
group_run_rights(_action : EgwAction, _senders : EgwActionObject[])
|
||||
{
|
||||
let ids = [];
|
||||
let row_ids = []
|
||||
_senders.forEach((sender) => {
|
||||
row_ids.push(sender.id);
|
||||
ids.push(sender.id.split("::").pop());
|
||||
})
|
||||
const dialog = new Et2Dialog(this.egw);
|
||||
let attrs = {
|
||||
template: this.egw.webserverUrl + "/admin/templates/default/group.run_rights.xet",
|
||||
title: "Applications",
|
||||
hideOnEscape: true,
|
||||
width: "400",
|
||||
height: "300px",
|
||||
value: {
|
||||
content: {groups: ids}
|
||||
},
|
||||
callback: (button_id, value) => {
|
||||
if(button_id == "_cancel") return;
|
||||
|
||||
let acl_id = [];
|
||||
(value.apps ?? []).forEach(app => {
|
||||
ids.forEach(account => {
|
||||
acl_id.push(app + ":" + account +":run");
|
||||
})
|
||||
});
|
||||
if(value && value.apps && acl_id.length)
|
||||
{
|
||||
const button = <Et2Button>dialog.querySelector("[id*='"+button_id+"']");
|
||||
if(button) button.disabled=true;
|
||||
this.egw.request(
|
||||
'admin_acl::ajax_change_acl',
|
||||
[acl_id, button_id == "_add" ? 1 : 0, [], this.et2.getInstanceManager().etemplate_exec_id]
|
||||
).then((_data) => {
|
||||
this.et2.getInstanceManager().refresh(_data.msg, this.appname,row_ids,'update');
|
||||
dialog.close();
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
dialog.transformAttributes(attrs);
|
||||
this.et2.getInstanceManager().DOMContainer.appendChild(dialog);
|
||||
dialog.updateComplete.then(() => {
|
||||
dialog.template.widgetContainer.getWidgetById("apps").focus();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify an ACL entry
|
||||
*
|
||||
|
20
admin/templates/default/group.run_rights.xet
Normal file
20
admin/templates/default/group.run_rights.xet
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2.0//EN" "https://www.egroupware.org/etemplate2.0.dtd">
|
||||
<overlay>
|
||||
<template id="admin.group.run_rights" template="" lang="" group="0" version="23.001">
|
||||
<et2-vbox>
|
||||
<et2-select-account id="groups" readonly="true" multiple="true" rows="8"></et2-select-account>
|
||||
<et2-select-app id="apps" rows="8" multiple="1" autofocus="true"></et2-select-app>
|
||||
</et2-vbox>
|
||||
<et2-button id="add" slot="buttons" label="Add" noSubmit="true"></et2-button>
|
||||
<et2-button id="remove" slot="buttons" image="minus" label="Remove" noSubmit="true"></et2-button>
|
||||
<et2-button id="cancel" slot="buttons" align="right" label="Cancel" noSubmit="true"></et2-button>
|
||||
<styles>
|
||||
#_groups {
|
||||
max-height: 8em;
|
||||
overflow-y: auto;
|
||||
flex-grow: 2;
|
||||
}
|
||||
</styles>
|
||||
</template>
|
||||
</overlay>
|
Loading…
Reference in New Issue
Block a user