public List < Permission > getEffectivePermissions ( UserPrincipal user ) { final LinkedHashSet < Permission > permissions = new LinkedHashSet <> ( ) ; if ( user . getPermissions ( ) != null ) { permissions . addAll ( user . getPermissions ( ) ) ; } if ( user . getTeams ( ) != null ) { for ( final Team team : user . getTeams ( ) ) { final List < Permission > teamPermissions = getObjectById ( Team . class , team . getId ( ) ) . getPermissions ( ) ; if ( teamPermissions != null ) { permissions . addAll ( teamPermissions ) ; } } } return new ArrayList <> ( permissions ) ; }
Determines the effective permissions for the specified user by collecting a List of all permissions assigned to the user either directly or through team membership .