2020-05-20 12:15:37 +02:00
Ext . define ( 'PBS.window.ACLEdit' , {
extend : 'Proxmox.window.Edit' ,
alias : 'widget.pbsACLAdd' ,
mixins : [ 'Proxmox.Mixin.CBind' ] ,
2020-09-21 13:25:48 +02:00
onlineHelp : 'user_acl' ,
2020-05-20 12:15:37 +02:00
url : '/access/acl' ,
method : 'PUT' ,
isAdd : true ,
isCreate : true ,
2020-07-25 20:10:06 +02:00
width : 450 ,
2020-05-20 12:15:37 +02:00
// caller can give a static path
path : undefined ,
2022-05-14 14:50:38 +02:00
defaultFocus : 'proxmoxcheckbox' ,
2020-05-20 12:15:37 +02:00
2020-10-28 11:07:27 +01:00
initComponent : function ( ) {
2020-05-20 12:15:37 +02:00
let me = this ;
2020-10-28 11:07:27 +01:00
me . items = [ ] ;
2020-05-20 12:15:37 +02:00
2020-10-28 11:07:27 +01:00
me . items . push ( {
2022-05-18 18:09:15 +02:00
xtype : 'pbsPermissionPathSelector' ,
2020-11-10 08:19:17 +01:00
name : 'path' ,
2020-05-20 12:15:37 +02:00
fieldLabel : gettext ( 'Path' ) ,
2022-05-18 18:09:15 +02:00
allowBlank : false ,
//editable: !me.path,
2020-10-28 11:07:27 +01:00
value : me . path ,
2022-05-18 18:09:15 +02:00
datastore : me . datastore ,
2020-10-28 11:07:27 +01:00
} ) ;
if ( me . aclType === 'user' ) {
me . subject = gettext ( 'User Permission' ) ;
me . items . push ( {
2021-11-17 09:27:21 +01:00
xtype : 'pmxUserSelector' ,
2020-10-30 15:18:41 +01:00
name : 'auth-id' ,
2020-11-10 08:19:17 +01:00
fieldLabel : gettext ( 'User' ) ,
2020-10-28 11:07:27 +01:00
allowBlank : false ,
} ) ;
} else if ( me . aclType === 'token' ) {
me . subject = gettext ( 'API Token Permission' ) ;
me . items . push ( {
xtype : 'pbsTokenSelector' ,
2020-10-30 15:18:41 +01:00
name : 'auth-id' ,
2020-11-10 08:19:17 +01:00
fieldLabel : gettext ( 'API Token' ) ,
2020-10-28 11:07:27 +01:00
allowBlank : false ,
} ) ;
}
me . items . push ( {
2020-05-20 12:15:37 +02:00
xtype : 'pmxRoleSelector' ,
name : 'role' ,
fieldLabel : gettext ( 'Role' ) ,
2020-11-10 08:19:17 +01:00
value : 'NoAccess' ,
2020-10-28 11:07:27 +01:00
} ) ;
me . items . push ( {
2020-05-20 12:15:37 +02:00
xtype : 'proxmoxcheckbox' ,
name : 'propagate' ,
2020-11-10 08:19:17 +01:00
fieldLabel : gettext ( 'Propagate' ) ,
2020-05-20 12:15:37 +02:00
checked : true ,
uncheckedValue : 0 ,
2020-10-28 11:07:27 +01:00
} ) ;
me . callParent ( ) ;
} ,
2020-05-20 12:15:37 +02:00
} ) ;