summaryrefslogtreecommitdiffstats
path: root/src/com/gitblit/wicket/pages/EditRepositoryPage.java
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2011-12-07 19:33:10 -0500
committerJames Moger <james.moger@gitblit.com>2011-12-07 19:33:10 -0500
commitfe24a0be919653d9e502f7729d9a804f2e28435d (patch)
treea63d2b07ce300843ae061d435c8891e8e5a930dc /src/com/gitblit/wicket/pages/EditRepositoryPage.java
parent7e8873a14ccc2cb25213489d7d7ba97f09673831 (diff)
downloadgitblit-fe24a0be919653d9e502f7729d9a804f2e28435d.tar.gz
gitblit-fe24a0be919653d9e502f7729d9a804f2e28435d.zip
Teams support.
Teams simplify the management of user-repository access permissions. Teams have a list of restricted repositories. Users are also added to teams and that grants them access to those repositories. Federation and RPC support are still in-progress.
Diffstat (limited to 'src/com/gitblit/wicket/pages/EditRepositoryPage.java')
-rw-r--r--src/com/gitblit/wicket/pages/EditRepositoryPage.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/com/gitblit/wicket/pages/EditRepositoryPage.java b/src/com/gitblit/wicket/pages/EditRepositoryPage.java
index be88bd5f..1a5ec3dd 100644
--- a/src/com/gitblit/wicket/pages/EditRepositoryPage.java
+++ b/src/com/gitblit/wicket/pages/EditRepositoryPage.java
@@ -75,12 +75,14 @@ public class EditRepositoryPage extends RootSubPage {
List<String> federationSets = new ArrayList<String>();
List<String> repositoryUsers = new ArrayList<String>();
+ List<String> repositoryTeams = new ArrayList<String>();
if (isCreate) {
super.setupPage(getString("gb.newRepository"), "");
} else {
super.setupPage(getString("gb.edit"), repositoryModel.name);
if (repositoryModel.accessRestriction.exceeds(AccessRestrictionType.NONE)) {
repositoryUsers.addAll(GitBlit.self().getRepositoryUsers(repositoryModel));
+ repositoryTeams.addAll(GitBlit.self().getRepositoryTeams(repositoryModel));
Collections.sort(repositoryUsers);
}
federationSets.addAll(repositoryModel.federationSets);
@@ -93,6 +95,11 @@ public class EditRepositoryPage extends RootSubPage {
repositoryUsers), new CollectionModel<String>(GitBlit.self().getAllUsernames()),
new ChoiceRenderer<String>("", ""), 10, false);
+ // teams palette
+ final Palette<String> teamsPalette = new Palette<String>("teams", new ListModel<String>(
+ repositoryTeams), new CollectionModel<String>(GitBlit.self().getAllTeamnames()),
+ new ChoiceRenderer<String>("", ""), 10, false);
+
// federation sets palette
List<String> sets = GitBlit.getStrings(Keys.federation.sets);
final Palette<String> federationSetsPalette = new Palette<String>("federationSets",
@@ -165,8 +172,9 @@ public class EditRepositoryPage extends RootSubPage {
// save the repository
GitBlit.self().updateRepositoryModel(oldName, repositoryModel, isCreate);
- // save the repository access list
+ // repository access
if (repositoryModel.accessRestriction.exceeds(AccessRestrictionType.NONE)) {
+ // save the user access list
Iterator<String> users = usersPalette.getSelectedChoices();
List<String> repositoryUsers = new ArrayList<String>();
while (users.hasNext()) {
@@ -178,6 +186,14 @@ public class EditRepositoryPage extends RootSubPage {
repositoryUsers.add(repositoryModel.owner);
}
GitBlit.self().setRepositoryUsers(repositoryModel, repositoryUsers);
+
+ // save the team access list
+ Iterator<String> teams = teamsPalette.getSelectedChoices();
+ List<String> repositoryTeams = new ArrayList<String>();
+ while (teams.hasNext()) {
+ repositoryTeams.add(teams.next());
+ }
+ GitBlit.self().setRepositoryTeams(repositoryModel, repositoryTeams);
}
} catch (GitBlitException e) {
error(e.getMessage());
@@ -215,6 +231,7 @@ public class EditRepositoryPage extends RootSubPage {
form.add(new CheckBox("skipSizeCalculation"));
form.add(new CheckBox("skipSummaryMetrics"));
form.add(usersPalette);
+ form.add(teamsPalette);
form.add(federationSetsPalette);
form.add(new Button("save"));