Package org.activiti.explorer.identity

Examples of org.activiti.explorer.identity.LoggedInUserImpl


public class DefaultLoginHandler implements LoginHandler {

  private transient IdentityService identityService;

  public LoggedInUserImpl authenticate(String userName, String password) {
    LoggedInUserImpl loggedInUser = null;
   
    try {
      if (identityService.checkPassword(userName, password)) {
        User user = identityService.createUserQuery().userId(userName).singleResult();
        // Fetch and cache user data
        loggedInUser = new LoggedInUserImpl(user, password);
        List<Group> groups = identityService.createGroupQuery().groupMember(user.getId()).list();
        for (Group group : groups) {
 
          if (Constants.SECURITY_ROLE.equals(group.getType())) {
            loggedInUser.addSecurityRoleGroup(group);
            if (Constants.SECURITY_ROLE_USER.equals(group.getId())) {
              loggedInUser.setUser(true);
            }
            if (Constants.SECURITY_ROLE_ADMIN.equals(group.getId())) {
              loggedInUser.setAdmin(true);
            }
          } else if (ExplorerApp.get().getAdminGroups() != null
                      && ExplorerApp.get().getAdminGroups().contains(group.getId())) {
            loggedInUser.addSecurityRoleGroup(group);
            loggedInUser.setAdmin(true);
          } else if (ExplorerApp.get().getUserGroups() != null
                  && ExplorerApp.get().getUserGroups().contains(group.getId())) {
            loggedInUser.addSecurityRoleGroup(group);
            loggedInUser.setUser(true);
          } else {
            loggedInUser.addGroup(group);
          }
         
         
        }
      }
View Full Code Here


public class DefaultLoginHandler implements LoginHandler {

  private IdentityService identityService;

  public LoggedInUserImpl authenticate(String userName, String password) {
    LoggedInUserImpl loggedInUser = null;
    if (identityService.checkPassword(userName, password)) {
      User user = identityService.createUserQuery().userId(userName).singleResult();
      // Fetch and cache user data
      loggedInUser = new LoggedInUserImpl(user, password);
      List<Group> groups = identityService.createGroupQuery().groupMember(user.getId()).list();
      for (Group group : groups) {
        if (Constants.SECURITY_ROLE.equals(group.getType())) {
          loggedInUser.addSecurityRoleGroup(group);
          if (Constants.SECURITY_ROLE_USER.equals(group.getId())) {
            loggedInUser.setUser(true);
          }
          if (Constants.SECURITY_ROLE_ADMIN.equals(group.getId())) {
            loggedInUser.setAdmin(true);
          }
        } else {
          loggedInUser.addGroup(group);
        }
      }
    }
   
    return loggedInUser;
View Full Code Here

TOP

Related Classes of org.activiti.explorer.identity.LoggedInUserImpl

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.