@Override public List<Attribute> initialize(String voShortName, String groupName) throws PerunException { Vo vo = vosManager.getVoByShortName(registrarSession, voShortName); List<Attribute> list = attrManager.getAttributes(registrarSession, vo); // load group info if needed if (groupName != null && !groupName.isEmpty()) { Group group = perun.getGroupsManager().getGroupByName(registrarSession, vo, groupName); list.addAll(attrManager.getAttributes(registrarSession, group)); } return list; }
/** * Return all members of specific group. . * * @param group group specific group * @return group members of group * @throws VOOTException cannot read members of group */ private List<Member> getGroupMembers(Group group) throws VOOTException { List<Member> members = new ArrayList<Member>(); try { if (!perun.getGroupsManagerBl().isUserMemberOfGroup(session, user, group)) { // if not group member, check authorization in Entry members = perun.getGroupsManager().getGroupMembers(session, group); } else { members = perun.getGroupsManagerBl().getGroupMembers(session, group); } } catch (InternalErrorException ex){ throw new VOOTException("internal_server_error"); } catch (PrivilegeException ex) { throw new VOOTException("insufficient_privileges"); } catch (GroupNotExistsException ex) { throw new VOOTException("group_not_exists"); } return members; }
@Override public ApplicationForm mapRow(ResultSet rs, int arg1) throws SQLException { ApplicationForm form = new ApplicationForm(); form.setId(rs.getInt("id")); form.setAutomaticApproval(rs.getBoolean("automatic_approval")); form.setAutomaticApprovalExtension(rs.getBoolean("automatic_approval_extension")); form.setModuleClassName(rs.getString("module_name")); try { form.setVo(vosManager.getVoById(registrarSession, rs.getInt("vo_id"))); } catch (Exception ex) { // we don't care, shouldn't happen for internal identity. } try { if (rs.getInt("group_id") != 0) form.setGroup(perun.getGroupsManager().getGroupById(registrarSession, rs.getInt("group_id"))); } catch (Exception ex) { // we don't care, shouldn't happen for internal identity. } return form; } }, id);
@Override public ApplicationForm mapRow(ResultSet rs, int arg1) throws SQLException { ApplicationForm form = new ApplicationForm(); form.setId(rs.getInt("id")); form.setAutomaticApproval(rs.getBoolean("automatic_approval")); form.setAutomaticApprovalExtension(rs.getBoolean("automatic_approval_extension")); form.setModuleClassName(rs.getString("module_name")); try { form.setVo(vosManager.getVoById(registrarSession, rs.getInt("vo_id"))); } catch (Exception ex) { // we don't care, shouldn't happen for internal identity. } try { if (rs.getInt("group_id") != 0) form.setGroup(perun.getGroupsManager().getGroupById(registrarSession, rs.getInt("group_id"))); } catch (Exception ex) { // we don't care, shouldn't happen for internal identity. } return form; } }, id);
group = perun.getGroupsManager().getGroupByName(registrarSession, vo, groupName); result.put("group", group); result.put("groupForm", getFormForGroup(group));
/** * Init method, instantiate PerunSession * * @throws PerunException */ protected void initialize() throws PerunException { // gets session for a system principal "perunRegistrar" final PerunPrincipal pp = new PerunPrincipal("perunRegistrar", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL); registrarSession = perun.getPerunSession(pp, new PerunClient()); this.attrManager = perun.getAttributesManager(); this.membersManager = perun.getMembersManager(); this.usersManager = perun.getUsersManager(); this.groupsManager = perun.getGroupsManager(); }
perun.getGroupsManager().addMember(registrarSession, app.getGroup(), member);
this.groupsManager = perun.getGroupsManager(); this.usersManager = perun.getUsersManager(); this.vosManager = perun.getVosManager();
if (group != null) { List<Group> g = perun.getGroupsManager().getMemberGroups(registrarSession, m); if (g.contains(group)) {