mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15:44 +01:00
start implementation of ui for global user permissions
This commit is contained in:
@@ -47,7 +47,7 @@ Sonia.group.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
|
||||
|
||||
initComponent: function(){
|
||||
this.addEvents('preCreate', 'created', 'preUpdate', 'updated', 'updateFailed', 'creationFailed');
|
||||
Sonia.repository.FormPanel.superclass.initComponent.apply(this, arguments);
|
||||
Sonia.group.FormPanel.superclass.initComponent.apply(this, arguments);
|
||||
},
|
||||
|
||||
update: function(group){
|
||||
|
||||
@@ -105,7 +105,7 @@ Sonia.group.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
|
||||
renderMembers: function(members){
|
||||
var out = '';
|
||||
if ( members != null ){
|
||||
if ( members !== null ){
|
||||
var s = members.length;
|
||||
for ( var i=0; i<s; i++ ){
|
||||
out += members[i];
|
||||
@@ -152,7 +152,6 @@ Sonia.group.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
}
|
||||
}
|
||||
},{
|
||||
item: group,
|
||||
xtype: 'permissionsPanel',
|
||||
baseUrl: 'security/permission/group/' + group.name
|
||||
}]);
|
||||
|
||||
@@ -39,7 +39,7 @@ Sonia.group.setEditPanel = function(panels){
|
||||
});
|
||||
editPanel.setActiveTab(0);
|
||||
editPanel.doLayout();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* panels
|
||||
@@ -51,4 +51,4 @@ Sonia.group.DefaultPanel = {
|
||||
bodyCssClass: 'x-panel-mc',
|
||||
padding: 5,
|
||||
html: 'Add or select a Group'
|
||||
}
|
||||
};
|
||||
|
||||
@@ -69,9 +69,9 @@ Sonia.group.MemberFormPanel = Ext.extend(Sonia.group.FormPanel, {
|
||||
singleSelect: true
|
||||
});
|
||||
|
||||
if ( this.item != null ){
|
||||
if ( this.item !== null ){
|
||||
var data = [];
|
||||
if ( this.item.members != null ){
|
||||
if ( this.item.members !== null ){
|
||||
for ( var i=0; i<this.item.members.length; i++ ){
|
||||
var a = [];
|
||||
a.push( this.item.members[i] );
|
||||
|
||||
@@ -70,7 +70,7 @@ Sonia.group.Panel = Ext.extend(Sonia.rest.Panel, {
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||
Sonia.group.Panel.superclass.initComponent.apply(this, arguments);
|
||||
@@ -104,7 +104,7 @@ Sonia.group.Panel = Ext.extend(Sonia.rest.Panel, {
|
||||
buttons: Ext.MessageBox.OKCANCEL,
|
||||
icon: Ext.MessageBox.QUESTION,
|
||||
fn: function(result){
|
||||
if ( result == 'ok' ){
|
||||
if ( result === 'ok' ){
|
||||
|
||||
if ( debug ){
|
||||
console.debug( 'remove group ' + item.name );
|
||||
|
||||
@@ -38,7 +38,7 @@ Sonia.group.PropertiesFormPanel = Ext.extend(Sonia.group.FormPanel, {
|
||||
fieldLabel: this.nameText,
|
||||
name: 'name',
|
||||
allowBlank: false,
|
||||
readOnly: this.item != null,
|
||||
readOnly: this.item !== null,
|
||||
helpText: this.nameHelpText,
|
||||
vtype: 'name'
|
||||
},{
|
||||
@@ -47,7 +47,7 @@ Sonia.group.PropertiesFormPanel = Ext.extend(Sonia.group.FormPanel, {
|
||||
xtype: 'textarea',
|
||||
helpText: this.descriptionHelpText
|
||||
}]
|
||||
}
|
||||
};
|
||||
|
||||
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||
Sonia.group.PropertiesFormPanel.superclass.initComponent.apply(this, arguments);
|
||||
|
||||
@@ -57,7 +57,7 @@ Sonia.user.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
|
||||
fieldLabel: this.nameText,
|
||||
name: 'name',
|
||||
allowBlank: false,
|
||||
readOnly: this.item != null,
|
||||
readOnly: this.item !== null,
|
||||
helpText: this.usernameHelpText,
|
||||
vtype: 'username'
|
||||
},{
|
||||
@@ -75,7 +75,7 @@ Sonia.user.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
|
||||
helpText: this.mailHelpText
|
||||
}];
|
||||
|
||||
if ( this.item == null || this.item.type == state.defaultUserType ){
|
||||
if ( this.item === null || this.item.type === state.defaultUserType ){
|
||||
items.push({
|
||||
fieldLabel: this.passwordText,
|
||||
id: 'pwd',
|
||||
@@ -115,7 +115,7 @@ Sonia.user.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
|
||||
},
|
||||
|
||||
isReadOnly: function(){
|
||||
return this.item != null && this.item.type != state.defaultUserType;
|
||||
return this.item !== null && this.item.type !== state.defaultUserType;
|
||||
},
|
||||
|
||||
fixRequest: function(user){
|
||||
|
||||
@@ -128,13 +128,16 @@ Sonia.user.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
if ( item.type == state.defaultUserType ){
|
||||
if ( item.type === state.defaultUserType ){
|
||||
panel.getForm().setValues([
|
||||
{id: 'password', value: dummyPassword},
|
||||
{id: 'password-confirm', value: dummyPassword}
|
||||
]);
|
||||
}
|
||||
Sonia.user.setEditPanel(panel);
|
||||
Sonia.user.setEditPanel([panel,{
|
||||
xtype: 'permissionsPanel',
|
||||
baseUrl: 'security/permission/user/' + item.name
|
||||
}]);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
@@ -34,12 +34,15 @@ Ext.ns('Sonia.user');
|
||||
|
||||
// functions
|
||||
|
||||
Sonia.user.setEditPanel = function(panel){
|
||||
Sonia.user.setEditPanel = function(panels){
|
||||
var editPanel = Ext.getCmp('userEditPanel');
|
||||
editPanel.removeAll();
|
||||
Ext.each(panels, function(panel){
|
||||
editPanel.add(panel);
|
||||
});
|
||||
editPanel.setActiveTab(0);
|
||||
editPanel.doLayout();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Panels
|
||||
@@ -49,6 +52,7 @@ Sonia.user.DefaultPanel = {
|
||||
title: 'User Form',
|
||||
padding: 5,
|
||||
xtype: 'panel',
|
||||
bodyCssClass: 'x-panel-mc',
|
||||
html: 'Add or select an User'
|
||||
};
|
||||
|
||||
|
||||
@@ -61,20 +61,20 @@ Sonia.user.Panel = Ext.extend(Sonia.rest.Panel, {
|
||||
xtype: 'userGrid',
|
||||
region: 'center',
|
||||
parentPanel: this
|
||||
},{
|
||||
}, {
|
||||
id: 'userEditPanel',
|
||||
layout: 'fit',
|
||||
items: [{
|
||||
region: 'south',
|
||||
title: 'User Form',
|
||||
xtype: 'panel',
|
||||
padding: 5,
|
||||
html: this.emptyText
|
||||
}],
|
||||
xtype: 'tabpanel',
|
||||
activeTab: 0,
|
||||
height: 250,
|
||||
split: true,
|
||||
border: false,
|
||||
region: 'south'
|
||||
border: true,
|
||||
region: 'south',
|
||||
items: [{
|
||||
bodyCssClass: 'x-panel-mc',
|
||||
title: 'User Form',
|
||||
padding: 5,
|
||||
html: this.emptyText
|
||||
}]
|
||||
}]
|
||||
};
|
||||
|
||||
@@ -103,10 +103,8 @@ Sonia.user.Panel = Ext.extend(Sonia.rest.Panel, {
|
||||
},
|
||||
|
||||
showAddPanel: function(){
|
||||
var editPanel = Ext.getCmp('userEditPanel');
|
||||
editPanel.removeAll();
|
||||
var panel = new Sonia.user.FormPanel({
|
||||
region: 'south',
|
||||
Sonia.user.setEditPanel({
|
||||
xtype: 'userEditPanel',
|
||||
title: this.titleText,
|
||||
padding: 5,
|
||||
onUpdate: {
|
||||
@@ -118,8 +116,6 @@ Sonia.user.Panel = Ext.extend(Sonia.rest.Panel, {
|
||||
scope: this
|
||||
}
|
||||
});
|
||||
editPanel.add(panel);
|
||||
editPanel.doLayout();
|
||||
},
|
||||
|
||||
resetPanel: function(){
|
||||
@@ -140,7 +136,7 @@ Sonia.user.Panel = Ext.extend(Sonia.rest.Panel, {
|
||||
buttons: Ext.MessageBox.OKCANCEL,
|
||||
icon: Ext.MessageBox.QUESTION,
|
||||
fn: function(result){
|
||||
if ( result == 'ok' ){
|
||||
if ( result === 'ok' ){
|
||||
|
||||
if ( debug ){
|
||||
console.debug( 'remove user ' + item.name );
|
||||
|
||||
Reference in New Issue
Block a user