Search in sources :

Example 1 with UserAccountType

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

the class UserFacade method getTypeValue.

private UserAccountType getTypeValue(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);
    }
    UserAccountType val;
    try {
        int v = Integer.parseInt(value);
        val = UserAccountType.fromValue(v);
    } catch (IllegalArgumentException e) {
        try {
            val = UserAccountType.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 : InvalidQueryException(io.hops.hopsworks.exceptions.InvalidQueryException) UserAccountType(io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountType)

Example 2 with UserAccountType

use of io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountType 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)

Aggregations

UserAccountType (io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountType)2 InvalidQueryException (io.hops.hopsworks.exceptions.InvalidQueryException)1 RemoteUserType (io.hops.hopsworks.persistence.entity.remote.user.RemoteUserType)1 BbcGroup (io.hops.hopsworks.persistence.entity.user.BbcGroup)1 UserAccountStatus (io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus)1 PostConstruct (javax.annotation.PostConstruct)1 SelectItem (javax.faces.model.SelectItem)1