Search in sources :

Example 1 with GroupRoles

use of org.olat.basesecurity.GroupRoles in project OpenOLAT by OpenOLAT.

the class BGRightManagerImpl method findBGRights.

/**
 * @see org.olat.group.right.BGRightManager#findBGRights(org.olat.group.BusinessGroup)
 */
@Override
public List<String> findBGRights(BusinessGroup group, BGRightsRole role) {
    GroupRoles groupRole = null;
    if (role == BGRightsRole.tutor) {
        groupRole = GroupRoles.coach;
    } else if (role == BGRightsRole.participant) {
        groupRole = GroupRoles.participant;
    } else {
        return Collections.emptyList();
    }
    List<Grant> grants = groupDao.getGrants(group.getBaseGroup(), groupRole.name());
    // filter all business group rights permissions. group right permissions
    // start with bgr.
    List<String> rights = new ArrayList<>();
    for (Grant grant : grants) {
        String right = grant.getPermission();
        if (right.indexOf(BG_RIGHT_PREFIX) == 0) {
            rights.add(right);
        }
    }
    return rights;
}
Also used : Grant(org.olat.basesecurity.Grant) GroupRoles(org.olat.basesecurity.GroupRoles) ArrayList(java.util.ArrayList)

Example 2 with GroupRoles

use of org.olat.basesecurity.GroupRoles in project openolat by klemens.

the class BGRightManagerImpl method findBGRights.

/**
 * @see org.olat.group.right.BGRightManager#findBGRights(org.olat.group.BusinessGroup)
 */
@Override
public List<String> findBGRights(BusinessGroup group, BGRightsRole role) {
    GroupRoles groupRole = null;
    if (role == BGRightsRole.tutor) {
        groupRole = GroupRoles.coach;
    } else if (role == BGRightsRole.participant) {
        groupRole = GroupRoles.participant;
    } else {
        return Collections.emptyList();
    }
    List<Grant> grants = groupDao.getGrants(group.getBaseGroup(), groupRole.name());
    // filter all business group rights permissions. group right permissions
    // start with bgr.
    List<String> rights = new ArrayList<>();
    for (Grant grant : grants) {
        String right = grant.getPermission();
        if (right.indexOf(BG_RIGHT_PREFIX) == 0) {
            rights.add(right);
        }
    }
    return rights;
}
Also used : Grant(org.olat.basesecurity.Grant) GroupRoles(org.olat.basesecurity.GroupRoles) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 Grant (org.olat.basesecurity.Grant)2 GroupRoles (org.olat.basesecurity.GroupRoles)2