Search in sources :

Example 11 with BbcGroup

use of io.hops.hopsworks.persistence.entity.user.BbcGroup in project hopsworks by logicalclocks.

the class UserFacade method addGroup.

/**
 * Add a new group for a user.
 *
 * @param userMail
 * @param gidNumber
 */
public void addGroup(String userMail, int gidNumber) {
    BbcGroup bbcGroup = em.find(BbcGroup.class, gidNumber);
    Users user = findByEmail(userMail);
    user.getBbcGroupCollection().add(bbcGroup);
    em.merge(user);
}
Also used : BbcGroup(io.hops.hopsworks.persistence.entity.user.BbcGroup) Users(io.hops.hopsworks.persistence.entity.user.Users)

Example 12 with BbcGroup

use of io.hops.hopsworks.persistence.entity.user.BbcGroup in project hopsworks by logicalclocks.

the class UserFacade method findAllInGroup.

public List<Integer> findAllInGroup(int gid) {
    BbcGroup role = groupFacade.find(gid);
    List<Integer> uIds = new ArrayList<>();
    if (role == null) {
        return uIds;
    }
    List<BbcGroup> roles = new ArrayList<>();
    roles.add(role);
    TypedQuery<Integer> query = em.createNamedQuery("Users.findAllInGroup", Integer.class);
    query.setParameter("roles", roles);
    uIds.addAll(query.getResultList());
    return uIds;
}
Also used : BbcGroup(io.hops.hopsworks.persistence.entity.user.BbcGroup) ArrayList(java.util.ArrayList)

Example 13 with BbcGroup

use of io.hops.hopsworks.persistence.entity.user.BbcGroup in project hopsworks by logicalclocks.

the class AdminProfileAdministration method init.

@PostConstruct
public void init() {
    groups = new ArrayList<>();
    status = new ArrayList<>();
    for (BbcGroup value : bbcGroupFacade.findAll()) {
        groups.add(value.getGroupName());
    }
    editingUser = (Users) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("editinguser");
    if (editingUser != null) {
        login = (Userlogins) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("editinguser_logins");
    } else {
        String email = FacesContext.getCurrentInstance().getExternalContext().getRemoteUser();
        editingUser = userFacade.findByEmail(email);
        login = auditManager.getLastUserLogin(editingUser);
    }
}
Also used : BbcGroup(io.hops.hopsworks.persistence.entity.user.BbcGroup) PostConstruct(javax.annotation.PostConstruct)

Example 14 with BbcGroup

use of io.hops.hopsworks.persistence.entity.user.BbcGroup in project hopsworks by logicalclocks.

the class AdminProfileAdministration method getNewGroups.

public List<String> getNewGroups() {
    List<String> list = usersController.getUserRoles(editingUser);
    List<String> tmp = new ArrayList<>();
    for (BbcGroup b : bbcGroupFacade.findAll()) {
        if (!list.contains(b.getGroupName())) {
            tmp.add(b.getGroupName());
        }
    }
    return tmp;
}
Also used : BbcGroup(io.hops.hopsworks.persistence.entity.user.BbcGroup) ArrayList(java.util.ArrayList)

Example 15 with BbcGroup

use of io.hops.hopsworks.persistence.entity.user.BbcGroup 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

BbcGroup (io.hops.hopsworks.persistence.entity.user.BbcGroup)25 Users (io.hops.hopsworks.persistence.entity.user.Users)11 ArrayList (java.util.ArrayList)10 UserException (io.hops.hopsworks.exceptions.UserException)6 Date (java.util.Date)3 Secret (io.hops.hopsworks.common.security.utils.Secret)2 Timestamp (java.sql.Timestamp)2 PostConstruct (javax.annotation.PostConstruct)2 ResourceRequest (io.hops.hopsworks.common.api.ResourceRequest)1 HopsSecurityException (io.hops.hopsworks.exceptions.HopsSecurityException)1 InvalidQueryException (io.hops.hopsworks.exceptions.InvalidQueryException)1 RemoteUserType (io.hops.hopsworks.persistence.entity.remote.user.RemoteUserType)1 UserAccountStatus (io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountStatus)1 UserAccountType (io.hops.hopsworks.persistence.entity.user.security.ua.UserAccountType)1 ApiOperation (io.swagger.annotations.ApiOperation)1 URI (java.net.URI)1 SelectItem (javax.faces.model.SelectItem)1 MessagingException (javax.mail.MessagingException)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1