From 2b74b1c8252c8ba74bde65c6ca010cbcde1a2ac4 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 7 Jan 2011 19:32:08 +0100 Subject: [PATCH] added groupPermission attribute to repository permission grid --- .../webapp/resources/js/sonia.repository.js | 57 +++++++++++++++++-- 1 file changed, 51 insertions(+), 6 deletions(-) diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.repository.js b/scm-webapp/src/main/webapp/resources/js/sonia.repository.js index 406f9f1725..2cf6051876 100644 --- a/scm-webapp/src/main/webapp/resources/js/sonia.repository.js +++ b/scm-webapp/src/main/webapp/resources/js/sonia.repository.js @@ -46,6 +46,35 @@ Ext.ns('Sonia.repository'); // functions +Sonia.repository.getPermissionValue = function(type){ + var value = 0; + switch (type){ + case "READ": + value = 0; + break; + case "WRITE": + value = 10; + break; + case "OWNER": + value = 100; + break; + } + return value; +} + +Sonia.repository.isMember = function(group){ + var result = false; + if ( Ext.isDefined(state.groups) ){ + for ( var i=0; i= value ){ + if ( p.groupPermission ){ + if ( Sonia.repository.isMember( p.name ) ){ + result = true; + break; + } + } else if ( p.name == state.user.name ) { + result = true; + break; + } } } } @@ -187,7 +226,7 @@ Sonia.repository.FormPanel = Ext.extend(Sonia.rest.FormPanel,{ this.permissionStore = new Ext.data.JsonStore({ root: 'permissions', - fields: [ 'name', 'type' ], + fields: [ 'name', 'type', 'groupPermission' ], sortInfo: { field: 'name' } @@ -208,6 +247,7 @@ Sonia.repository.FormPanel = Ext.extend(Sonia.rest.FormPanel,{ id: 'type', header: 'Type', dataIndex: 'type', + width: 80, editor: new Ext.form.ComboBox({ valueField: 'type', displayField: 'type', @@ -224,8 +264,13 @@ Sonia.repository.FormPanel = Ext.extend(Sonia.rest.FormPanel,{ ] }) }) - } - ] + },{ + id: 'groupPermission', + header: 'Group', + dataIndex: 'groupPermission', + width: 60, + editor: new Ext.form.Checkbox() + }] }); if ( update ){