Package org.activiti.engine.identity

Examples of org.activiti.engine.identity.User


    } else if (!passwordField1.getValue().equals(passwordField2.getValue())){
      errorLabel.setValue(i18nManager.getMessage(Messages.PASSWORD_CHANGE_INPUT_MATCH));
    } else {
      String password = passwordField1.getValue().toString();
      // Change data
      User user = identityService.createUserQuery().userId(currentUser.getId()).singleResult();
      user.setPassword(password);
      identityService.saveUser(user);
     
      // Refresh logged in user session data
      ExplorerApp.get().setUser(ExplorerApp.get().getLoginHandler().authenticate(
          user.getId(), user.getPassword()));
     
      // Close popup
      close();
     
      // Show notification
View Full Code Here


  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())) {
View Full Code Here

  @Autowired
  protected IdentityService identityService;
 
  @RequestMapping(value="/identity/users/{userId}/info", method = RequestMethod.GET, produces = "application/json")
  public List<UserInfoResponse> getUserInfo(@PathVariable String userId, HttpServletRequest request) {
    User user = getUserFromRequest(userId);
   
    List<UserInfoResponse> responses = new ArrayList<UserInfoResponse>();
    String serverRootUrl = request.getRequestURL().toString();
    serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/identity/users/"));
    // Create responses for all keys,not including value as this is exposed through the individual resource URL.
    for (String key : identityService.getUserInfoKeys(user.getId())) {
      responses.add(restResponseFactory.createUserInfoResponse(key, null, user.getId(), serverRootUrl));
    }
   
    return responses;
  }
View Full Code Here

 
  @RequestMapping(value="/identity/users/{userId}/info", method = RequestMethod.POST, produces = "application/json")
  public UserInfoResponse setUserInfo(@PathVariable String userId, @RequestBody UserInfoRequest userRequest,
      HttpServletRequest request, HttpServletResponse response) {
   
    User user = getUserFromRequest(userId);
   
    if (userRequest.getKey() == null) {
      throw new ActivitiIllegalArgumentException("The key cannot be null.");
    }
    if (userRequest.getValue() == null) {
      throw new ActivitiIllegalArgumentException("The value cannot be null.");
    }
   
    String existingValue = identityService.getUserInfo(user.getId(), userRequest.getKey());
    if (existingValue != null) {
      throw new ActivitiConflictException("User info with key '" + userRequest.getKey() + "' already exists for this user.");
    }
   
    identityService.setUserInfo(user.getId(), userRequest.getKey(), userRequest.getValue());
   
    response.setStatus(HttpStatus.CREATED.value());
    String serverRootUrl = request.getRequestURL().toString();
    serverRootUrl = serverRootUrl.substring(0, serverRootUrl.indexOf("/identity/users/"));
    return restResponseFactory.createUserInfoResponse(userRequest.getKey(), userRequest.getValue(), user.getId(), serverRootUrl);
  }
View Full Code Here

 
  @Autowired
  protected IdentityService identityService;

  protected User getUserFromRequest(String userId) {
    User user = identityService.createUserQuery().userId(userId).singleResult();

    if (user == null) {
      throw new ActivitiObjectNotFoundException("Could not find a user with id '" + userId + "'.", User.class);
    }
    return user;
View Full Code Here

    return restResponseFactory.createUserResponse(getUserFromRequest(userId), false, serverRootUrl);
  }
 
  @RequestMapping(value="/identity/users/{userId}", method = RequestMethod.PUT, produces = "application/json")
  public UserResponse updateUser(@PathVariable String userId, @RequestBody UserRequest userRequest, HttpServletRequest request) {
    User user = getUserFromRequest(userId);
    if (userRequest.isEmailChanged()) {
      user.setEmail(userRequest.getEmail());
    }
    if (userRequest.isFirstNameChanged()) {
      user.setFirstName(userRequest.getFirstName());
    }
    if (userRequest.isLastNameChanged()) {
      user.setLastName(userRequest.getLastName());
    }
    if (userRequest.isPasswordChanged()) {
      user.setPassword(userRequest.getPassword());
    }
   
    identityService.saveUser(user);
   
    String serverRootUrl = request.getRequestURL().toString();
View Full Code Here

    return restResponseFactory.createUserResponse(user, false, serverRootUrl);
  }
 
  @RequestMapping(value="/identity/users/{userId}", method = RequestMethod.DELETE)
  public void deleteUser(@PathVariable String userId, HttpServletResponse response) {
    User user = getUserFromRequest(userId);
    identityService.deleteUser(user.getId());
    response.setStatus(HttpStatus.NO_CONTENT.value());
  }
View Full Code Here

 
  public void testUserQueryById() {
    List<User> users = identityService.createUserQuery().userId("kermit").list();
    assertEquals(1, users.size());
   
    User user = users.get(0);
    assertEquals("kermit", user.getId());
    assertEquals("Kermit", user.getFirstName());
    assertEquals("The Frog", user.getLastName());
   
    user = identityService.createUserQuery().userId("fozzie").singleResult();
    assertEquals("fozzie", user.getId());
    assertEquals("Fozzie", user.getFirstName());
    assertEquals("Bear", user.getLastName());
  }
View Full Code Here

  public void testUserQueryByFullNameLike() {
    List<User> users = identityService.createUserQuery().userFullNameLike("ermi").list();
    assertEquals(1, users.size());
    assertEquals(1, identityService.createUserQuery().userFullNameLike("ermi").count());
   
    User user = users.get(0);
    assertEquals("kermit", user.getId());
    assertEquals("Kermit", user.getFirstName());
    assertEquals("The Frog", user.getLastName());
   
    users = identityService.createUserQuery().userFullNameLike("rog").list();
    assertEquals(1, users.size());
    assertEquals(1, identityService.createUserQuery().userFullNameLike("rog").count());
   
    user = users.get(0);
    assertEquals("kermit", user.getId());
    assertEquals("Kermit", user.getFirstName());
    assertEquals("The Frog", user.getLastName());
   
    users = identityService.createUserQuery().userFullNameLike("e").list();
    assertEquals(5, users.size());
    assertEquals(5, identityService.createUserQuery().userFullNameLike("e").count());
   
View Full Code Here

@RestController
public class UserPictureResource extends BaseUserResource {

  @RequestMapping(value="/identity/users/{userId}/picture", method = RequestMethod.GET, produces = "application/json")
  public @ResponseBody byte[] getUserPicture(@PathVariable String userId, HttpServletRequest request, HttpServletResponse response) {
    User user = getUserFromRequest(userId);
    Picture userPicture = identityService.getUserPicture(user.getId());
   
    if (userPicture == null) {
      throw new ActivitiObjectNotFoundException("The user with id '" + user.getId() + "' does not have a picture.", Picture.class);
    }
   
    String mediaType = "image/jpeg";
    if (userPicture.getMimeType() != null) {
      mediaType = userPicture.getMimeType();
View Full Code Here

TOP

Related Classes of org.activiti.engine.identity.User

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.