gb.administration = administration
gb.plugins = plugins
gb.extensions = extensions
-gb.anonymous = Anonymous
-gb.anonymousRepoDescription = Anyone can see, clone, and push to this repository.
-gb.public = Public
-gb.publicRepoDescription = Anyone can see and clone this repository. You choose who can push.
-gb.protected = Protected
-gb.protectedRepoDescription = Anyone can see this repository. You choose who can clone and push.
+gb.anonymousPush = Anonymous Pushes
+gb.anonymousPushDescription = Anyone can see, clone, and push to this repository.
+gb.pushRestrictedAuthenticated = Restrict Pushes (Authenticated)
+gb.pushRestrictedAuthenticatedDescription = Anyone can see and clone this repository. All authenticated users can push.
+gb.pushRestrictedNamed = Restrict Pushes (Named)
+gb.pushRestrictedNamedDescription = Anyone can see and clone this repository. You choose who can push.
+gb.cloneRestricted = Restrict Clones & Pushes
+gb.cloneRestrictedDescription = Anyone can see this repository. You choose who can clone and push.
gb.private = Private
gb.privateRepoDescription = You choose who can see, clone, and push to this repository.
gb.initialCommit = Initial Commit
repositoryModel.name = fullName;\r
repositoryModel.projectPath = null;\r
\r
- Permission permisison = permissionGroup.getModelObject();\r
- repositoryModel.accessRestriction = permisison.type;\r
- repositoryModel.authorizationControl = AuthorizationControl.NAMED;\r
+ Permission permission = permissionGroup.getModelObject();\r
+ repositoryModel.authorizationControl = permission.control;\r
+ repositoryModel.accessRestriction = permission.type;\r
\r
repositoryModel.owners = new ArrayList<String>();\r
repositoryModel.owners.add(GitBlitWebSession.get().getUsername());\r
form.add(new TextField<String>("name"));\r
form.add(new TextField<String>("description"));\r
\r
- Permission anonymousPermission = new Permission(getString("gb.anonymous"), getString("gb.anonymousRepoDescription"), "blank.png", AccessRestrictionType.NONE);\r
- Permission publicPermission = new Permission(getString("gb.public"), getString("gb.publicRepoDescription"), "lock_go_16x16.png", AccessRestrictionType.PUSH);\r
- Permission protectedPermission = new Permission(getString("gb.protected"), getString("gb.protectedRepoDescription"), "lock_pull_16x16.png", AccessRestrictionType.CLONE);\r
- Permission privatePermission = new Permission(getString("gb.private"), getString("gb.privateRepoDescription"), "shield_16x16.png", AccessRestrictionType.VIEW);\r
+ Permission anonymousPermission = new Permission(getString("gb.anonymousPush"),\r
+ getString("gb.anonymousPushDescription"),\r
+ "blank.png",\r
+ AuthorizationControl.AUTHENTICATED,\r
+ AccessRestrictionType.NONE);\r
+\r
+ Permission authenticatedPermission = new Permission(getString("gb.pushRestrictedAuthenticated"),\r
+ getString("gb.pushRestrictedAuthenticatedDescription"),\r
+ "lock_go_16x16.png",\r
+ AuthorizationControl.AUTHENTICATED,\r
+ AccessRestrictionType.PUSH);\r
+\r
+ Permission publicPermission = new Permission(getString("gb.pushRestrictedNamed"),\r
+ getString("gb.pushRestrictedNamedDescription"),\r
+ "lock_go_16x16.png",\r
+ AuthorizationControl.NAMED,\r
+ AccessRestrictionType.PUSH);\r
+\r
+ Permission protectedPermission = new Permission(getString("gb.cloneRestricted"),\r
+ getString("gb.cloneRestrictedDescription"),\r
+ "lock_pull_16x16.png",\r
+ AuthorizationControl.NAMED,\r
+ AccessRestrictionType.CLONE);\r
+\r
+ Permission privatePermission = new Permission(getString("gb.private"),\r
+ getString("gb.privateRepoDescription"),\r
+ "shield_16x16.png",\r
+ AuthorizationControl.NAMED,\r
+ AccessRestrictionType.VIEW);\r
\r
List<Permission> permissions = new ArrayList<Permission>();\r
if (app().settings().getBoolean(Keys.git.allowAnonymousPushes, false)) {\r
permissions.add(anonymousPermission);\r
}\r
+ permissions.add(authenticatedPermission);\r
permissions.add(publicPermission);\r
permissions.add(protectedPermission);\r
permissions.add(privatePermission);\r
if (AccessRestrictionType.NONE == defaultRestriction) {\r
defaultRestriction = AccessRestrictionType.PUSH;\r
}\r
+ AuthorizationControl defaultControl = AuthorizationControl.fromName(\r
+ app().settings().getString(Keys.git.defaultAuthorizationControl, AuthorizationControl.NAMED.name()));\r
+\r
+ if (AuthorizationControl.AUTHENTICATED == defaultControl) {\r
+ defaultRestriction = AccessRestrictionType.PUSH;\r
+ }\r
\r
Permission defaultPermission = publicPermission;\r
for (Permission permission : permissions) {\r
- if (permission.type == defaultRestriction) {\r
+ if (permission.type == defaultRestriction\r
+ && permission.control == defaultControl) {\r
defaultPermission = permission;\r
}\r
}\r
final String name;\r
final String description;\r
final String image;\r
+ final AuthorizationControl control;\r
final AccessRestrictionType type;\r
\r
- Permission(String name, String description, String img, AccessRestrictionType type) {\r
+ Permission(String name, String description, String img, AuthorizationControl control, AccessRestrictionType type) {\r
this.name = name;\r
this.description = description;\r
this.image = img;\r
+ this.control = control;\r
this.type = type;\r
}\r
}\r