diff --git a/scm-core/src/main/java/sonia/scm/user/User.java b/scm-core/src/main/java/sonia/scm/user/User.java
index 3eb282933b..3884f02bd9 100644
--- a/scm-core/src/main/java/sonia/scm/user/User.java
+++ b/scm-core/src/main/java/sonia/scm/user/User.java
@@ -59,7 +59,7 @@ import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder =
{
- "name", "displayName", "mail", "password", "type"
+ "name", "displayName", "mail", "password", "admin", "type"
})
public class User
implements TypedObject, Principal, Cloneable, Validateable, Serializable
@@ -267,6 +267,17 @@ public class User
return type;
}
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ public boolean isAdmin()
+ {
+ return admin;
+ }
+
/**
* Method description
*
@@ -283,6 +294,17 @@ public class User
//~--- set methods ----------------------------------------------------------
+ /**
+ * Method description
+ *
+ *
+ * @param admin
+ */
+ public void setAdmin(boolean admin)
+ {
+ this.admin = admin;
+ }
+
/**
* Method description
*
@@ -341,6 +363,9 @@ public class User
//~--- fields ---------------------------------------------------------------
+ /** Field description */
+ private boolean admin;
+
/** Field description */
private String displayName;
diff --git a/scm-core/src/main/resources/sonia/scm/config/admin-account.xml b/scm-core/src/main/resources/sonia/scm/config/admin-account.xml
index f66a6bda0c..1f48b7235b 100644
--- a/scm-core/src/main/resources/sonia/scm/config/admin-account.xml
+++ b/scm-core/src/main/resources/sonia/scm/config/admin-account.xml
@@ -4,5 +4,6 @@
SCM Administrator
scm-admin@scm-manager.com
ff8f5c593a01f9fcd3ed48b09a4b013e8d8f3be7
+ true
xml
diff --git a/scm-webapp/src/main/java/sonia/scm/api/rest/JsonJaxbContextResolver.java b/scm-webapp/src/main/java/sonia/scm/api/rest/JsonJaxbContextResolver.java
index b2f4a324f5..1c79ab4c2f 100644
--- a/scm-webapp/src/main/java/sonia/scm/api/rest/JsonJaxbContextResolver.java
+++ b/scm-webapp/src/main/java/sonia/scm/api/rest/JsonJaxbContextResolver.java
@@ -29,6 +29,8 @@
*
*/
+
+
package sonia.scm.api.rest;
//~--- non-JDK imports --------------------------------------------------------
@@ -36,6 +38,7 @@ package sonia.scm.api.rest;
import sonia.scm.ScmState;
import sonia.scm.group.Group;
import sonia.scm.repository.Repository;
+import sonia.scm.user.User;
//~--- JDK imports ------------------------------------------------------------
@@ -70,8 +73,8 @@ public class JsonJaxbContextResolver implements ContextResolver
JSONConfiguration.mapped().rootUnwrapping(true).arrays(
"member", "groups", "permissions", "repositories",
"repositoryTypes").nonStrings(
- "readable", "writeable", "groupPermission").build(), types.toArray(
- new Class[0]));
+ "readable", "writeable", "groupPermission",
+ "admin").build(), types.toArray(new Class[0]));
}
//~--- get methods ----------------------------------------------------------
@@ -99,5 +102,5 @@ public class JsonJaxbContextResolver implements ContextResolver
/** Field description */
private List types = Arrays.asList(new Class[] { Group.class,
- Repository.class, ScmState.class });
+ Repository.class, ScmState.class, User.class });
}
diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.rest.js b/scm-webapp/src/main/webapp/resources/js/sonia.rest.js
index 5a264a33fa..267590bb09 100644
--- a/scm-webapp/src/main/webapp/resources/js/sonia.rest.js
+++ b/scm-webapp/src/main/webapp/resources/js/sonia.rest.js
@@ -65,6 +65,7 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, {
urlTemplate: '{0}',
mailtoTemplate: '{0}',
+ checkboxTemplate: '',
initComponent: function(){
@@ -118,6 +119,14 @@ Sonia.rest.Grid = Ext.extend(Ext.grid.GridPanel, {
renderMailto: function(mail){
return String.format( this.mailtoTemplate, mail );
+ },
+
+ renderCheckbox: function(value){
+ var param = "";
+ if ( value ){
+ param = "checked='checked' ";
+ }
+ return String.format( this.checkboxTemplate, param );
}
});
diff --git a/scm-webapp/src/main/webapp/resources/js/sonia.user.js b/scm-webapp/src/main/webapp/resources/js/sonia.user.js
index 7c86c5d0b5..945f210d36 100644
--- a/scm-webapp/src/main/webapp/resources/js/sonia.user.js
+++ b/scm-webapp/src/main/webapp/resources/js/sonia.user.js
@@ -40,7 +40,7 @@ Sonia.user.Grid = Ext.extend(Sonia.rest.Grid, {
var userStore = new Sonia.rest.JsonStore({
url: restUrl + 'users.json',
root: 'users',
- fields: [ 'name', 'displayName', 'mail', 'type'],
+ fields: [ 'name', 'displayName', 'mail', 'admin', 'type'],
sortInfo: {
field: 'name'
}
@@ -56,6 +56,7 @@ Sonia.user.Grid = Ext.extend(Sonia.rest.Grid, {
{id: 'name', header: 'Name', dataIndex: 'name'},
{id: 'displayName', header: 'Display Name', dataIndex: 'displayName', width: 250},
{id: 'mail', header: 'Mail', dataIndex: 'mail', renderer: this.renderMailto, width: 200},
+ {id: 'admin', header: 'Admin', dataIndex: 'admin', renderer: this.renderCheckbox, width: 50},
{id: 'type', header: 'Type', dataIndex: 'type', width: 80}
]
});
@@ -151,6 +152,10 @@ Sonia.user.FormPanel = Ext.extend(Sonia.rest.FormPanel,{
minLengthText: 'Password must be at least 6 characters long.',
vtype: 'password',
initialPassField: 'pwd'
+ },{
+ fieldLabel: 'Administrator',
+ name: 'admin',
+ xtype: 'checkbox'
}]
};