form.add(confirmPasswordField.setEnabled(editCredentials));\r
form.add(new TextField<String>("displayName").setEnabled(editDisplayName));\r
form.add(new TextField<String>("emailAddress").setEnabled(editEmailAddress));\r
- form.add(new CheckBox("canAdmin"));\r
- form.add(new CheckBox("canFork").setEnabled(app().settings().getBoolean(Keys.web.allowForking, true)));\r
- form.add(new CheckBox("canCreate"));\r
+\r
+ if (userModel.canAdmin() && !userModel.canAdmin) {\r
+ // user inherits Admin permission\r
+ // display a disabled-yet-checked checkbox\r
+ form.add(new CheckBox("canAdmin", Model.of(true)).setEnabled(false));\r
+ } else {\r
+ form.add(new CheckBox("canAdmin"));\r
+ }\r
+\r
+ if (userModel.canFork() && !userModel.canFork) {\r
+ // user inherits Fork permission\r
+ // display a disabled-yet-checked checkbox\r
+ form.add(new CheckBox("canFork", Model.of(true)).setEnabled(false));\r
+ } else {\r
+ final boolean forkingAllowed = app().settings().getBoolean(Keys.web.allowForking, true);\r
+ form.add(new CheckBox("canFork").setEnabled(forkingAllowed));\r
+ }\r
+\r
+ if (userModel.canCreate() && !userModel.canCreate) {\r
+ // user inherits Create permission\r
+ // display a disabled-yet-checked checkbox\r
+ form.add(new CheckBox("canCreate", Model.of(true)).setEnabled(false));\r
+ } else {\r
+ form.add(new CheckBox("canCreate"));\r
+ }\r
+\r
form.add(new CheckBox("excludeFromFederation"));\r
form.add(new CheckBox("disabled"));\r
\r