Package com.gitblit

Examples of com.gitblit.ConfigUserService


  protected IUserService createUserService(File realmFile) {
    IUserService service = null;
    if (realmFile.getName().toLowerCase().endsWith(".conf")) {
      // config-based realm file
      service = new ConfigUserService(realmFile);
    }

    assert service != null;

    if (!realmFile.exists()) {
View Full Code Here


      String realm = ext.substring(0, ext.indexOf("userservice"));
      us = gitblitSettings.getString(MessageFormat.format("realm.{0}.backingUserService", realm), "${baseFolder}/users.conf");
    }

    if (us.endsWith(".conf")) {
      service = new ConfigUserService(FileUtils.resolveParameter(Constants.baseFolder$, folder, us));
    } else {
      throw new RuntimeException("Unsupported user service: " + us);
    }

    service = new ConfigUserService(FileUtils.resolveParameter(Constants.baseFolder$, folder, us));
    return service;
  }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void testFile() throws Exception {
    File realmFile = new File("src/test/resources/issue0259.conf");
    ConfigUserService service = new ConfigUserService(realmFile);

    RepositoryModel test = repo("test.git", AccessRestrictionType.VIEW);
    RepositoryModel projects_test = repo("projects/test.git", AccessRestrictionType.VIEW);

    UserModel a = service.getUserModel("a");
    UserModel b = service.getUserModel("b");
    UserModel c = service.getUserModel("c");

    // assert RWD or RW+ for projects/test.git
    assertEquals(AccessPermission.DELETE, a.getRepositoryPermission(projects_test).permission);
    assertEquals(AccessPermission.DELETE, b.getRepositoryPermission(projects_test).permission);
    assertEquals(AccessPermission.REWIND, c.getRepositoryPermission(projects_test).permission);
View Full Code Here

  protected IUserService createUserService(File realmFile) {
    IUserService service = null;
    if (realmFile.getName().toLowerCase().endsWith(".conf")) {
      // config-based realm file
      service = new ConfigUserService(realmFile);
    }

    assert service != null;

    if (!realmFile.exists()) {
View Full Code Here

      // and updates existing teams.
      Collection<UserModel> users = FederationUtils.getUsers(registration);
      if (users != null && users.size() > 0) {
        File realmFile = new File(registrationFolderFile, registration.name + "_users.conf");
        realmFile.delete();
        userService = new ConfigUserService(realmFile);
        for (UserModel user : users) {
          userService.updateUserModel(user.username, user);

          // merge the origin permissions and origin accounts into
          // the user accounts of this Gitblit instance
View Full Code Here

   * @throws Exception
   */
  @Test
  public void testFile() throws Exception {
    File realmFile = new File("src/test/resources/issue0271.conf");
    ConfigUserService service = new ConfigUserService(realmFile);

    RepositoryModel test = repo("test.git", AccessRestrictionType.VIEW);
    RepositoryModel teama_test = repo("teama/test.git", AccessRestrictionType.VIEW);

    UserModel a = service.getUserModel("a");
    UserModel b = service.getUserModel("b");
    UserModel c = service.getUserModel("c");

    // assert V for test.git
    assertEquals(AccessPermission.VIEW, a.getRepositoryPermission(test).permission);
    assertEquals(AccessPermission.VIEW, b.getRepositoryPermission(test).permission);
    assertEquals(AccessPermission.VIEW, c.getRepositoryPermission(test).permission);
View Full Code Here

  @Test
  public void testConfigUserService() throws IOException {
    File file = new File("us-test.conf");
    file.delete();
    IUserService service = new ConfigUserService(file);
    testUsers(service);
    testTeams(service);
    file.delete();
  }
View Full Code Here

TOP

Related Classes of com.gitblit.ConfigUserService

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.