Search in sources :

Example 1 with UserAccountStatus

use of io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus in project hopsworks by logicalclocks.

the class Register method init.

@PostConstruct
public void init() {
    this.roles = new ArrayList<>();
    this.availableStatus = new ArrayList<>();
    this.accountTypes = new ArrayList<>();
    this.remoteUserTypes = new ArrayList<>();
    for (RemoteUserType rt : RemoteUserType.values()) {
        if (RemoteUserType.OAUTH2.equals(rt)) {
            // OAuth2 not supported
            continue;
        }
        this.remoteUserTypes.add(new SelectItem(rt.getValue(), rt.toString()));
    }
    for (UserAccountType t : UserAccountType.values()) {
        this.accountTypes.add(new SelectItem(t.getValue(), t.toString()));
    }
    for (UserAccountStatus p : UserAccountStatus.values()) {
        this.availableStatus.add(new SelectItem(p.getValue(), p.getUserStatus()));
    }
    for (BbcGroup value : bbcGroupFacade.findAll()) {
        this.roles.add(value.getGroupName());
    }
    resetDefault();
}
Also used : BbcGroup(io.hops.hopsworks.persistence.entity.user.BbcGroup) RemoteUserType(io.hops.hopsworks.persistence.entity.remote.user.RemoteUserType) UserAccountStatus(io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus) SelectItem(javax.faces.model.SelectItem) UserAccountType(io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountType) PostConstruct(javax.annotation.PostConstruct)

Example 2 with UserAccountStatus

use of io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus in project hopsworks by logicalclocks.

the class UserFacade method getStatusValue.

private UserAccountStatus getStatusValue(String field, String value) {
    if (value == null || value.isEmpty()) {
        throw new InvalidQueryException("Filter value for " + field + " needs to set an Integer or a valid " + field + ", but found: " + value);
    }
    UserAccountStatus val;
    try {
        int v = Integer.parseInt(value);
        val = UserAccountStatus.fromValue(v);
    } catch (IllegalArgumentException e) {
        try {
            val = UserAccountStatus.valueOf(value);
        } catch (IllegalArgumentException ie) {
            throw new InvalidQueryException("Filter value for " + field + " needs to set an Integer or a valid " + field + ", but found: " + value);
        }
    }
    return val;
}
Also used : UserAccountStatus(io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus) InvalidQueryException(io.hops.hopsworks.exceptions.InvalidQueryException)

Example 3 with UserAccountStatus

use of io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus in project hopsworks by logicalclocks.

the class AdminProfileAdministration method getStatus.

public List<String> getStatus() {
    status = new ArrayList<>();
    for (UserAccountStatus p : UserAccountStatus.values()) {
        status.add(p.name());
    }
    // Remove the inactive users
    status.remove(UserAccountStatus.NEW_MOBILE_ACCOUNT.name());
    return status;
}
Also used : UserAccountStatus(io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus)

Example 4 with UserAccountStatus

use of io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus in project hopsworks by logicalclocks.

the class AdminProfileAdministration method updateStatusByAdmin.

/**
 * Update user roles from profile by admin.
 */
public void updateStatusByAdmin() {
    HttpServletRequest httpServletRequest = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
    // Update status
    if (!"#!".equals(selectedStatus)) {
        UserAccountStatus status = UserAccountStatus.valueOf(selectedStatus);
        try {
            auditedUserAdministration.changeStatus(editingUser, status, httpServletRequest);
            editingUser = userFacade.find(editingUser.getUid());
            MessagesController.addInfoMessage("User " + editingUser.getEmail() + " status updated successfully.");
        } catch (UserException ex) {
            MessagesController.addInfoMessage("Problem Could not update account status.", ex.getMessage());
            LOGGER.log(Level.SEVERE, "Problem Could not update account status.", ex);
        }
    } else {
        MessagesController.addErrorMessage("Error", "No selection made!");
    }
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) UserAccountStatus(io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus) UserException(io.hops.hopsworks.exceptions.UserException)

Example 5 with UserAccountStatus

use of io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus in project hopsworks by logicalclocks.

the class AuditedUserAdministration method activateUser.

public void activateUser(Users user, HttpServletRequest httpServletRequest) throws UserException {
    // httpServletRequest needed for logging
    UserAccountStatus accountStatus = UserAccountStatus.ACTIVATED_ACCOUNT;
    usersController.changeAccountStatus(user.getUid(), accountStatus.getUserStatus(), accountStatus);
}
Also used : UserAccountStatus(io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus)

Aggregations

UserAccountStatus (io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus)6 NewUserDTO (io.hops.hopsworks.api.admin.dto.NewUserDTO)1 UserDTO (io.hops.hopsworks.common.dao.user.UserDTO)1 InvalidQueryException (io.hops.hopsworks.exceptions.InvalidQueryException)1 UserException (io.hops.hopsworks.exceptions.UserException)1 RemoteUserType (io.hops.hopsworks.persistence.entity.remote.user.RemoteUserType)1 BbcGroup (io.hops.hopsworks.persistence.entity.user.BbcGroup)1 Users (io.hops.hopsworks.persistence.entity.user.Users)1 UserAccountType (io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountType)1 URI (java.net.URI)1 PostConstruct (javax.annotation.PostConstruct)1 SelectItem (javax.faces.model.SelectItem)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1