]>
git.proxmox.com Git - pve-manager.git/blob - www/manager6/dc/ACLView.js
1 Ext
.define('PVE.dc.ACLAdd', {
2 extend
: 'Proxmox.window.Edit',
3 alias
: ['widget.pveACLAdd'],
7 initComponent : function() {
15 xtype
: me
.path
? 'hiddenfield' : 'pvePermPathSelector',
19 fieldLabel
: gettext('Path')
23 if (me
.aclType
=== 'group') {
24 me
.subject
= gettext("Group Permission");
26 xtype
: 'pveGroupSelector',
28 fieldLabel
: gettext('Group')
30 } else if (me
.aclType
=== 'user') {
31 me
.subject
= gettext("User Permission");
33 xtype
: 'pveUserSelector',
35 fieldLabel
: gettext('User')
37 } else if (me
.aclType
=== 'token') {
38 me
.subject
= gettext("API Token Permission");
40 xtype
: 'pveTokenSelector',
42 fieldLabel
: gettext('API Token')
45 throw "unknown ACL type";
49 xtype
: 'pveRoleSelector',
52 fieldLabel
: gettext('Role')
57 xtype
: 'proxmoxcheckbox',
61 fieldLabel
: gettext('Propagate')
65 var ipanel
= Ext
.create('Proxmox.panel.InputPanel', {
67 onlineHelp
: 'pveum_permission_management'
78 Ext
.define('PVE.dc.ACLView', {
79 extend
: 'Ext.grid.GridPanel',
81 alias
: ['widget.pveACLView'],
83 onlineHelp
: 'chapter_user_management',
91 initComponent : function() {
94 var store
= Ext
.create('Ext.data.Store',{
98 url
: "/api2/json/access/acl"
107 store
.addFilter(Ext
.create('Ext.util.Filter',{
108 filterFn: function(item
) {
109 if (item
.data
.path
=== me
.path
) {
116 var render_ugid = function(ugid
, metaData
, record
) {
117 if (record
.data
.type
== 'group') {
121 return Ext
.String
.htmlEncode(ugid
);
126 header
: gettext('User') + '/' + gettext('Group') + '/' + gettext('API Token'),
129 renderer
: render_ugid
,
133 header
: gettext('Role'),
142 header
: gettext('Path'),
148 header
: gettext('Propagate'),
151 dataIndex
: 'propagate'
155 var sm
= Ext
.create('Ext.selection.RowModel', {});
157 var reload = function() {
161 var remove_btn
= new Proxmox
.button
.Button({
162 text
: gettext('Remove'),
165 confirmMsg
: gettext('Are you sure you want to remove this entry'),
166 handler: function(btn
, event
, rec
) {
170 roles
: rec
.data
.roleid
172 if (rec
.data
.type
=== 'group') {
173 params
.groups
= rec
.data
.ugid
;
174 } else if (rec
.data
.type
=== 'user') {
175 params
.users
= rec
.data
.ugid
;
176 } else if (rec
.data
.type
=== 'token') {
177 params
.tokens
= rec
.data
.ugid
;
179 throw 'unknown data type';
182 Proxmox
.Utils
.API2Request({
187 callback: function() {
190 failure: function (response
, opts
) {
191 Ext
.Msg
.alert(gettext('Error'), response
.htmlStatus
);
197 Proxmox
.Utils
.monStoreErrors(me
, store
);
204 text
: gettext('Add'),
209 text
: gettext('Group Permission'),
210 iconCls
: 'fa fa-fw fa-group',
211 handler: function() {
212 var win
= Ext
.create('PVE.dc.ACLAdd',{
216 win
.on('destroy', reload
);
221 text
: gettext('User Permission'),
222 iconCls
: 'fa fa-fw fa-user',
223 handler: function() {
224 var win
= Ext
.create('PVE.dc.ACLAdd',{
228 win
.on('destroy', reload
);
233 text
: gettext('API Token Permission'),
234 iconCls
: 'fa fa-fw fa-user-o',
235 handler: function() {
236 var win
= Ext
.create('PVE.dc.ACLAdd',{
240 win
.on('destroy', reload
);
262 Ext
.define('pve-acl', {
263 extend
: 'Ext.data.Model',
265 'path', 'type', 'ugid', 'roleid',