Search in sources :

Example 1 with Permission

use of org.finos.waltz.model.permission_group.Permission in project waltz by khartec.

the class PermissionGroupService method findPermissions.

public List<Permission> findPermissions(EntityReference parentEntityRef, String username) {
    Person person = personService.getPersonByUserId(username);
    if (isNull(person)) {
        return Collections.emptyList();
    }
    List<Involvement> involvements = involvementService.findByEmployeeId(person.employeeId()).stream().filter(involvement -> involvement.entityReference().equals(parentEntityRef)).collect(Collectors.toList());
    if (involvements.isEmpty()) {
        return Collections.emptyList();
    }
    return permissionGroupDao.getDefaultPermissions();
}
Also used : Logger(org.slf4j.Logger) EntityKind(org.finos.waltz.model.EntityKind) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) PersonService(org.finos.waltz.service.person.PersonService) Collectors(java.util.stream.Collectors) Person(org.finos.waltz.model.person.Person) InvolvementService(org.finos.waltz.service.involvement.InvolvementService) List(java.util.List) Involvement(org.finos.waltz.model.involvement.Involvement) Service(org.springframework.stereotype.Service) EntityReference(org.finos.waltz.model.EntityReference) Objects.isNull(java.util.Objects.isNull) Permission(org.finos.waltz.model.permission_group.Permission) Collections(java.util.Collections) Involvement(org.finos.waltz.model.involvement.Involvement) Person(org.finos.waltz.model.person.Person)

Aggregations

Collections (java.util.Collections)1 List (java.util.List)1 Objects.isNull (java.util.Objects.isNull)1 Collectors (java.util.stream.Collectors)1 EntityKind (org.finos.waltz.model.EntityKind)1 EntityReference (org.finos.waltz.model.EntityReference)1 Involvement (org.finos.waltz.model.involvement.Involvement)1 Permission (org.finos.waltz.model.permission_group.Permission)1 Person (org.finos.waltz.model.person.Person)1 InvolvementService (org.finos.waltz.service.involvement.InvolvementService)1 PersonService (org.finos.waltz.service.person.PersonService)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Service (org.springframework.stereotype.Service)1