diff options
author | James Moger <james.moger@gitblit.com> | 2014-09-11 11:20:39 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-09-11 11:20:39 -0400 |
commit | 48019b15fb3ee3f5c46f9f6669bd538e28000a25 (patch) | |
tree | 7525f9b646eaa13294b5d1162bce9d1986ac9a58 /src/main/java | |
parent | 3ddd32fe366db8c7547c788d9988e7c60a72a3a8 (diff) | |
download | gitblit-48019b15fb3ee3f5c46f9f6669bd538e28000a25.tar.gz gitblit-48019b15fb3ee3f5c46f9f6669bd538e28000a25.zip |
Disable permission checkboxes if permission is inherited
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/gitblit/wicket/pages/EditUserPage.java | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/main/java/com/gitblit/wicket/pages/EditUserPage.java b/src/main/java/com/gitblit/wicket/pages/EditUserPage.java index b9a84805..454aa619 100644 --- a/src/main/java/com/gitblit/wicket/pages/EditUserPage.java +++ b/src/main/java/com/gitblit/wicket/pages/EditUserPage.java @@ -239,9 +239,32 @@ public class EditUserPage extends RootSubPage { form.add(confirmPasswordField.setEnabled(editCredentials));
form.add(new TextField<String>("displayName").setEnabled(editDisplayName));
form.add(new TextField<String>("emailAddress").setEnabled(editEmailAddress));
- form.add(new CheckBox("canAdmin"));
- form.add(new CheckBox("canFork").setEnabled(app().settings().getBoolean(Keys.web.allowForking, true)));
- form.add(new CheckBox("canCreate"));
+
+ if (userModel.canAdmin() && !userModel.canAdmin) {
+ // user inherits Admin permission
+ // display a disabled-yet-checked checkbox
+ form.add(new CheckBox("canAdmin", Model.of(true)).setEnabled(false));
+ } else {
+ form.add(new CheckBox("canAdmin"));
+ }
+
+ if (userModel.canFork() && !userModel.canFork) {
+ // user inherits Fork permission
+ // display a disabled-yet-checked checkbox
+ form.add(new CheckBox("canFork", Model.of(true)).setEnabled(false));
+ } else {
+ final boolean forkingAllowed = app().settings().getBoolean(Keys.web.allowForking, true);
+ form.add(new CheckBox("canFork").setEnabled(forkingAllowed));
+ }
+
+ if (userModel.canCreate() && !userModel.canCreate) {
+ // user inherits Create permission
+ // display a disabled-yet-checked checkbox
+ form.add(new CheckBox("canCreate", Model.of(true)).setEnabled(false));
+ } else {
+ form.add(new CheckBox("canCreate"));
+ }
+
form.add(new CheckBox("excludeFromFederation"));
form.add(new CheckBox("disabled"));
|