diff --git a/scm-webapp/src/main/webapp/resources/css/style.css b/scm-webapp/src/main/webapp/resources/css/style.css index e9176a7942..dda252141a 100644 --- a/scm-webapp/src/main/webapp/resources/css/style.css +++ b/scm-webapp/src/main/webapp/resources/css/style.css @@ -233,4 +233,4 @@ div.noscript-container h1 { .upload-icon { background: url('../images/add.png') no-repeat 0 0 !important; -} \ No newline at end of file +} diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.infopanel.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.infopanel.js index 45f9a06dc2..ce80afe1d0 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.infopanel.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.infopanel.js @@ -43,6 +43,11 @@ Sonia.repository.InfoPanel = Ext.extend(Ext.Panel, { contactText: 'Contact: ', urlText: 'Url: ', changesetViewerText: 'Commits', + + // TODO i18n + accessText: 'Access:', + accessReadOnly: 'Read-Only access', + accessReadWrite: 'Read+Write access', initComponent: function(){ @@ -51,6 +56,11 @@ Sonia.repository.InfoPanel = Ext.extend(Ext.Panel, { contact = String.format(this.mailTemplate, this.item.contact); } + var access = this.accessReadOnly; + if ( Sonia.repository.getPermissionType(this.item) !== 'READ' ){ + access = this.accessReadWrite; + } + var items = [{ xtype: 'label', text: this.nameText @@ -69,6 +79,12 @@ Sonia.repository.InfoPanel = Ext.extend(Ext.Panel, { },{ xtype: 'box', html: contact + },{ + xtype: 'label', + text: this.accessText + },{ + xtype: 'box', + html: '' + access + '' },{ xtype: 'label', text: this.urlText diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js index c962c24ae5..3d291994d4 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.js @@ -102,6 +102,27 @@ Sonia.repository.getTypeByName = function(name){ return type; }; +Sonia.repository.getPermissionType = function(repository){ + var values = []; + values['READ'] = 0; + values['WRITE'] = 10; + values['OWNER'] = 20; + + var type = 'READ'; + + if (state.assignedPermissions){ + Ext.each(state.assignedPermissions, function(p){ + var parts = p.split(':'); + if ( parts[0] === 'repository' && (parts[1] === '*' || parts[1] === repository.id)){ + if ( values[parts[2]] > values[type] ){ + type = parts[2]; + } + } + }); + } + return type; +}; + /** * default panel */