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);
}
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;
}
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);
}
}
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;
}
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();
}
Aggregations