Search in sources :

Example 1 with GlobalGroupType

use of ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.GlobalGroupType in project X-Road by nordic-institute.

the class GlobalConfImpl method isSubjectInGlobalGroup.

@Override
public boolean isSubjectInGlobalGroup(ClientId subjectId, GlobalGroupId groupId) {
    SharedParametersV2 p;
    try {
        p = confDir.getShared(groupId.getXRoadInstance());
    } catch (Exception e) {
        p = null;
        log.warn("Got exception while getting shared parameters.", e);
    }
    if (p == null) {
        return false;
    }
    GlobalGroupType group = p.findGlobalGroup(groupId);
    if (group == null) {
        return false;
    }
    return group.getGroupMember().stream().filter(m -> m.equals(subjectId)).findFirst().isPresent();
}
Also used : GlobalGroupType(ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.GlobalGroupType) ErrorCodes.translateException(ee.ria.xroad.common.ErrorCodes.translateException) CodedException(ee.ria.xroad.common.CodedException)

Aggregations

CodedException (ee.ria.xroad.common.CodedException)1 ErrorCodes.translateException (ee.ria.xroad.common.ErrorCodes.translateException)1 GlobalGroupType (ee.ria.xroad.common.conf.globalconf.sharedparameters.v2.GlobalGroupType)1