Package com.gitblit.models

Examples of com.gitblit.models.TeamModel


  public boolean setTeamAccessPermissions(RepositoryModel repository, Collection<RegistrantAccessPermission> permissions) {
    List<TeamModel> teams = new ArrayList<TeamModel>();
    for (RegistrantAccessPermission tp : permissions) {
      if (tp.mutable) {
        // only set explicitly defined access permissions
        TeamModel team = userManager.getTeamModel(tp.registrant);
        team.setRepositoryPermission(repository.name, tp.permission);
        teams.add(team);
      }
    }
    return userManager.updateTeamModels(teams);
  }
View Full Code Here


    }

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

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

    if (teamMembershipResult != null && teamMembershipResult.getEntryCount() > 0) {
      for (int i = 0; i < teamMembershipResult.getEntryCount(); i++) {
        SearchResultEntry teamEntry = teamMembershipResult.getSearchEntries().get(i);
        String teamName = teamEntry.getAttribute("cn").getValue();

        TeamModel teamModel = userManager.getTeamModel(teamName);
        if (teamModel == null) {
          teamModel = createTeamFromLdap(teamEntry);
        }

        user.teams.add(teamModel);
        teamModel.addUser(user.getName());
      }
    }
  }
View Full Code Here

      for (int i = 0; i < teamMembershipResult.getEntryCount(); i++) {
        SearchResultEntry teamEntry = teamMembershipResult.getSearchEntries().get(i);
        if (!teamEntry.hasAttribute("member")) {
          String teamName = teamEntry.getAttribute("cn").getValue();

          TeamModel teamModel = userManager.getTeamModel(teamName);
          if (teamModel == null) {
            teamModel = createTeamFromLdap(teamEntry);
            userManager.updateTeamModel(teamModel);
          }
        }
View Full Code Here

    }
    logger.info("Finished fetching empty teams from ldap.");
  }

  private TeamModel createTeamFromLdap(SearchResultEntry teamEntry) {
    TeamModel answer = new TeamModel(teamEntry.getAttributeValue("cn"));
    answer.accountType = getAccountType();
    // potentially retrieve other attributes here in the future

    return answer;
  }
View Full Code Here

  public EditTeamPage() {
    // create constructor
    super();
    isCreate = true;
    setupPage(new TeamModel(""));
    setStatelessHint(false);
    setOutputMarkupId(true);
  }
View Full Code Here

  public EditTeamPage(PageParameters params) {
    // edit constructor
    super(params);
    isCreate = false;
    String name = WicketUtils.getTeamname(params);
    TeamModel model = app().users().getTeamModel(name);
    setupPage(model);
    setStatelessHint(false);
    setOutputMarkupId(true);
  }
View Full Code Here

        if (StringUtils.isEmpty(teamname)) {
          error(getString("gb.pleaseSetTeamName"));
          return;
        }
        if (isCreate) {
          TeamModel model = app().users().getTeamModel(teamname);
          if (model != null) {
            error(MessageFormat.format(getString("gb.teamNameUnavailable"), teamname));
            return;
          }
        }
View Full Code Here

        // null check on "final" teams because JSON-sourced UserModel
        // can have a null teams object
        if (model.teams != null) {
          Set<TeamModel> userTeams = new HashSet<TeamModel>();
          for (TeamModel team : model.teams) {
            TeamModel t = teams.get(team.name.toLowerCase());
            if (t == null) {
              // new team
              t = team;
              teams.put(team.name.toLowerCase(), t);
            }
            // do not clobber existing team definition
            // maybe because this is a federated user
            t.addUser(model.username);
            userTeams.add(t);
          }
          // replace Team-Models in users by new ones.
          model.teams.clear();
          model.teams.addAll(userTeams);
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.