Examples of IUserService


Examples of com.alibaba.druid.spring.IUserService

            conn.commit();
            conn.close();
        }

        // user-service
        IUserService service = (IUserService) context.getBean("user-service");
        User user = new User();
        user.setName("xx");
        service.addUser(user);

        TestFilter filter = (TestFilter) context.getBean("test-filter");
        Assert.assertEquals(2, filter.getConnectCount());

        {
View Full Code Here

Examples of com.alibaba.dubbo.examples.generic.api.IUserService

    public static void main(String[] args) throws Exception {
        String config = GenericConsumer.class.getPackage().getName().replace('.', '/') + "/generic-consumer.xml";
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(config);
        context.start();
        IUserService userservice = (IUserService) context.getBean("userservice");
        User user = userservice.get(new Params("a=b"));
        System.out.println(user);
        System.in.read();
    }
View Full Code Here

Examples of com.brienwheeler.svc.users.IUserService

  public boolean isValid(String value, ConstraintValidatorContext context)
  {
    if (!StringUtils.hasText(value))
      return !constraintAnnotation.failOnEmpty();
   
    IUserService userService = applicationContext.getBean(constraintAnnotation.userService(), IUserService.class);
    return userService.findByUsername(value) == null;
  }
View Full Code Here

Examples of com.gcrm.service.IUserService

     * @param userName
     *            user name
     * @return user instance
     */
    public static User getUser(String userName) {
        IUserService userService = (IUserService) SpringContextUtil
                .getBean("userService");
        StringBuilder hqlBuilder = new StringBuilder(
                "select new User(name,password) from User");
        hqlBuilder.append(" where name = ?");
        try {
            List<User> result = userService.findByParam(hqlBuilder.toString(),
                    userName);
            if (result == null) {
                return null;
            } else {
                return result.get(0);
View Full Code Here

Examples of com.gitblit.IUserService

  @Override
  public UserManager start() {
    if (this.userService == null) {
      String realm = settings.getString(Keys.realm.userService, "${baseFolder}/users.conf");
      IUserService service = null;
      if (legacyBackingServices.containsKey(realm)) {
        // create the user service from the legacy config
        String realmKey = legacyBackingServices.get(realm);
        logger.warn("");
        logger.warn(Constants.BORDER2);
View Full Code Here

Examples of com.gitblit.IUserService

    }
    return this;
  }

  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()) {
      // Create the Administrator account for a new realm file
      try {
        realmFile.createNewFile();
      } catch (IOException x) {
        logger.error(MessageFormat.format("COULD NOT CREATE REALM FILE {0}!", realmFile), x);
      }
      UserModel admin = new UserModel("admin");
      admin.password = "admin";
      admin.canAdmin = true;
      admin.excludeFromFederation = true;
      service.updateUserModel(admin);
    }

    return service;
  }
View Full Code Here

Examples of com.gitblit.IUserService

    }
    gitblitSettings = new FileSettings(file.getAbsolutePath());
    mail = new MailService(gitblitSettings);
    String us = gitblitSettings.getString(Keys.realm.userService, "${baseFolder}/users.conf");
    String ext = us.substring(us.lastIndexOf(".") + 1).toLowerCase();
    IUserService service = null;
    if (!ext.equals("conf") && !ext.equals("properties") && ext.contains("userservice")) {
      String realm = ext.substring(0, ext.indexOf("userservice"));
      us = gitblitSettings.getString(MessageFormat.format("realm.{0}.backingUserService", realm), "${baseFolder}/users.conf");
    }
View Full Code Here

Examples of com.gitblit.IUserService

  @Override
  public UserManager start() {
    if (this.userService == null) {
      String realm = settings.getString(Keys.realm.userService, "${baseFolder}/users.conf");
      IUserService service = null;
      if (legacyBackingServices.containsKey(realm)) {
        // create the user service from the legacy config
        String realmKey = legacyBackingServices.get(realm);
        logger.warn("");
        logger.warn(Constants.BORDER2);
View Full Code Here

Examples of com.gitblit.IUserService

    }
    return this;
  }

  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()) {
      // Create the Administrator account for a new realm file
      try {
        realmFile.createNewFile();
      } catch (IOException x) {
        logger.error(MessageFormat.format("COULD NOT CREATE REALM FILE {0}!", realmFile), x);
      }
      UserModel admin = new UserModel("admin");
      admin.password = "admin";
      admin.canAdmin = true;
      admin.excludeFromFederation = true;
      service.updateUserModel(admin);
    }

    return service;
  }
View Full Code Here

Examples of com.gitblit.IUserService

      gitblit.updateConfiguration(r, repository);
      r.close();
    }

    IUserService userService = null;

    try {
      // Pull USERS
      // TeamModels are automatically pulled because they are contained
      // within the UserModel. The UserService creates unknown teams
      // 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
          if (registration.mergeAccounts) {
            // reparent all repository permissions if the local
            // repositories are stored within subfolders
            if (!StringUtils.isEmpty(registrationFolder)) {
              if (user.permissions != null) {
                // pulling from >= 1.2 version
                Map<String, AccessPermission> copy = new HashMap<String, AccessPermission>(user.permissions);
                user.permissions.clear();
                for (Map.Entry<String, AccessPermission> entry : copy.entrySet()) {
                  user.setRepositoryPermission(registrationFolder + "/" + entry.getKey(), entry.getValue());
                }
              } else {
                // pulling from <= 1.1 version
                List<String> permissions = new ArrayList<String>(user.repositories);
                user.repositories.clear();
                for (String permission : permissions) {
                  user.addRepositoryPermission(registrationFolder + "/" + permission);
                }
              }
            }

            // insert new user or update local user
            UserModel localUser = gitblit.getUserModel(user.username);
            if (localUser == null) {
              // create new local user
              gitblit.addUser(user);
            } else {
              // update repository permissions of local user
              if (user.permissions != null) {
                // pulling from >= 1.2 version
                Map<String, AccessPermission> copy = new HashMap<String, AccessPermission>(user.permissions);
                for (Map.Entry<String, AccessPermission> entry : copy.entrySet()) {
                  localUser.setRepositoryPermission(entry.getKey(), entry.getValue());
                }
              } else {
                // pulling from <= 1.1 version
                for (String repository : user.repositories) {
                  localUser.addRepositoryPermission(repository);
                }
              }
              localUser.password = user.password;
              localUser.canAdmin = user.canAdmin;
              gitblit.reviseUser(localUser.username, localUser);
            }

            for (String teamname : gitblit.getAllTeamNames()) {
              TeamModel team = gitblit.getTeamModel(teamname);
              if (user.isTeamMember(teamname) && !team.hasUser(user.username)) {
                // new team member
                team.addUser(user.username);
                gitblit.updateTeamModel(teamname, team);
              } else if (!user.isTeamMember(teamname) && team.hasUser(user.username)) {
                // remove team member
                team.removeUser(user.username);
                gitblit.updateTeamModel(teamname, team);
              }

              // update team repositories
              TeamModel remoteTeam = user.getTeam(teamname);
              if (remoteTeam != null) {
                if (remoteTeam.permissions != null) {
                  // pulling from >= 1.2
                  for (Map.Entry<String, AccessPermission> entry : remoteTeam.permissions.entrySet()){
                    team.setRepositoryPermission(entry.getKey(), entry.getValue());
                  }
                  gitblit.updateTeamModel(teamname, team);
                } else if (!ArrayUtils.isEmpty(remoteTeam.repositories)) {
                  // pulling from <= 1.1
                  team.addRepositoryPermissions(remoteTeam.repositories);
                  gitblit.updateTeamModel(teamname, team);
                }
              }
            }
          }
        }
      }
    } catch (ForbiddenException e) {
      // ignore forbidden exceptions
    } catch (IOException e) {
      logger.warn(MessageFormat.format(
          "Failed to retrieve USERS from federated gitblit ({0} @ {1})",
          registration.name, registration.url), e);
    }

    try {
      // Pull TEAMS
      // We explicitly pull these even though they are embedded in
      // UserModels because it is possible to use teams to specify
      // mailing lists or push scripts without specifying users.
      if (userService != null) {
        Collection<TeamModel> teams = FederationUtils.getTeams(registration);
        if (teams != null && teams.size() > 0) {
          for (TeamModel team : teams) {
            userService.updateTeamModel(team);
          }
        }
      }
    } catch (ForbiddenException e) {
      // ignore forbidden exceptions
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.