Package com.gitblit.models

Examples of com.gitblit.models.TeamModel


  public void testTeam_NONE_DELETE() throws Exception {
    RepositoryModel repository = new RepositoryModel("myrepo.git", null, null, new Date());
    repository.authorizationControl = AuthorizationControl.NAMED;
    repository.accessRestriction = AccessRestrictionType.NONE;

    TeamModel team = new TeamModel("test");
    team.setRepositoryPermission(repository.name, AccessPermission.DELETE);

    assertTrue("team CAN NOT view!", team.canView(repository));
    assertTrue("team CAN NOT clone!", team.canClone(repository));
    assertTrue("team CAN NOT push!", team.canPush(repository));

    assertTrue("team CAN NOT create ref!", team.canCreateRef(repository));
    assertTrue("team CAN NOT delete ref!", team.canDeleteRef(repository));
    assertTrue("team CAN NOT rewind ref!", team.canRewindRef(repository));

    assertEquals("team has wrong permission!", AccessPermission.REWIND, team.getRepositoryPermission(repository).permission);
  }
View Full Code Here


  public void testTeam_PUSH_DELETE() throws Exception {
    RepositoryModel repository = new RepositoryModel("myrepo.git", null, null, new Date());
    repository.authorizationControl = AuthorizationControl.NAMED;
    repository.accessRestriction = AccessRestrictionType.PUSH;

    TeamModel team = new TeamModel("test");
    team.setRepositoryPermission(repository.name, AccessPermission.DELETE);

    assertTrue("team CAN NOT view!", team.canView(repository));
    assertTrue("team CAN NOT clone!", team.canClone(repository));
    assertTrue("team CAN NOT push!", team.canPush(repository));

    assertTrue("team CAN NOT create ref!", team.canCreateRef(repository));
    assertTrue("team CAN NOT delete ref!", team.canDeleteRef(repository));
    assertFalse("team CAN rewind ref!", team.canRewindRef(repository));

    assertEquals("team has wrong permission!", AccessPermission.DELETE, team.getRepositoryPermission(repository).permission);
  }
View Full Code Here

  public void testTeam_CLONE_DELETE() throws Exception {
    RepositoryModel repository = new RepositoryModel("myrepo.git", null, null, new Date());
    repository.authorizationControl = AuthorizationControl.NAMED;
    repository.accessRestriction = AccessRestrictionType.CLONE;

    TeamModel team = new TeamModel("test");
    team.setRepositoryPermission(repository.name, AccessPermission.DELETE);

    assertTrue("team CAN NOT view!", team.canView(repository));
    assertTrue("team CAN NOT clone!", team.canClone(repository));
    assertTrue("team CAN NOT push!", team.canPush(repository));

    assertTrue("team CAN NOT create ref!", team.canCreateRef(repository));
    assertTrue("team CAN NOT delete ref!", team.canDeleteRef(repository));
    assertFalse("team CAN rewind ref!", team.canRewindRef(repository));

    assertEquals("team has wrong permission!", AccessPermission.DELETE, team.getRepositoryPermission(repository).permission);
  }
View Full Code Here

  public void testTeam_VIEW_DELETE() throws Exception {
    RepositoryModel repository = new RepositoryModel("myrepo.git", null, null, new Date());
    repository.authorizationControl = AuthorizationControl.NAMED;
    repository.accessRestriction = AccessRestrictionType.VIEW;

    TeamModel team = new TeamModel("test");
    team.setRepositoryPermission(repository.name, AccessPermission.DELETE);

    assertTrue("team CAN NOT view!", team.canView(repository));
    assertTrue("team CAN NOT clone!", team.canClone(repository));
    assertTrue("team CAN NOT push!", team.canPush(repository));

    assertTrue("team CAN NOT create ref!", team.canCreateRef(repository));
    assertTrue("team CAN NOT delete ref!", team.canDeleteRef(repository));
    assertFalse("team CAN rewind ref!", team.canRewindRef(repository));

    assertEquals("team has wrong permission!", AccessPermission.DELETE, team.getRepositoryPermission(repository).permission);
  }
View Full Code Here

  private List<TeamModel> getSelectedTeams() {
    List<TeamModel> teams = new ArrayList<TeamModel>();
    for (int viewRow : table.getSelectedRows()) {
      int modelRow = table.convertRowIndexToModel(viewRow);
      TeamModel model = tableModel.list.get(modelRow);
      teams.add(model);
    }
    return teams;
  }
View Full Code Here

    dialog.setPreReceiveScripts(gitblit.getPreReceiveScriptsUnused(null),
        gitblit.getPreReceiveScriptsInherited(null), null);
    dialog.setPostReceiveScripts(gitblit.getPostReceiveScriptsUnused(null),
        gitblit.getPostReceiveScriptsInherited(null), null);
    dialog.setVisible(true);
    final TeamModel newTeam = dialog.getTeam();
    if (newTeam == null) {
      return;
    }

    GitblitWorker worker = new GitblitWorker(this, RpcRequest.CREATE_TEAM) {
View Full Code Here

    dialog.setPreReceiveScripts(gitblit.getPreReceiveScriptsUnused(null),
        gitblit.getPreReceiveScriptsInherited(null), team.preReceiveScripts);
    dialog.setPostReceiveScripts(gitblit.getPostReceiveScriptsUnused(null),
        gitblit.getPostReceiveScriptsInherited(null), team.postReceiveScripts);
    dialog.setVisible(true);
    final TeamModel revisedTeam = dialog.getTeam();
    if (revisedTeam == null) {
      return;
    }

    GitblitWorker worker = new GitblitWorker(this, RpcRequest.EDIT_TEAM) {
View Full Code Here

    }

    // Team Scripts
    if (repository != null) {
      for (String teamname : getPermittedTeamnames(repository)) {
        TeamModel team = getTeamModel(teamname);
        if (!ArrayUtils.isEmpty(team.preReceiveScripts)) {
          scripts.addAll(team.preReceiveScripts);
        }
      }
    }
View Full Code Here

      }
    }
    // Team Scripts
    if (repository != null) {
      for (String teamname : getPermittedTeamnames(repository)) {
        TeamModel team = getTeamModel(teamname);
        if (!ArrayUtils.isEmpty(team.postReceiveScripts)) {
          scripts.addAll(team.postReceiveScripts);
        }
      }
    }
View Full Code Here

        }

        Iterator<String> selectedTeams = teams.getSelectedChoices();
        userModel.teams.clear();
        while (selectedTeams.hasNext()) {
          TeamModel team = app().users().getTeamModel(selectedTeams.next());
          if (team == null) {
            continue;
          }
          userModel.teams.add(team);
        }
View Full Code Here

TOP

Related Classes of com.gitblit.models.TeamModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.