Search in sources :

Example 26 with VreAuthorization

use of nl.knaw.huygens.timbuctoo.security.dto.VreAuthorization in project timbuctoo by HuygensING.

the class LocalFileVreAuthorizationAccess method getAuthorization.

@Override
public Optional<VreAuthorization> getAuthorization(String vreId, String userId) throws AuthorizationUnavailableException {
    Optional<VreAuthorization> authorizationValue = Optional.empty();
    File file = getFileOfVre(vreId);
    authorizationValue = getAuthorization(userId, authorizationValue, file);
    if (!authorizationValue.isPresent()) {
        file = authorizationsFolder.resolve("authorizations.json").toFile();
        authorizationValue = getAuthorization(userId, authorizationValue, file);
    }
    return authorizationValue;
}
Also used : File(java.io.File) VreAuthorization(nl.knaw.huygens.timbuctoo.security.dto.VreAuthorization)

Aggregations

VreAuthorization (nl.knaw.huygens.timbuctoo.security.dto.VreAuthorization)26 Test (org.junit.Test)22 File (java.io.File)5 Permission (nl.knaw.huygens.timbuctoo.v5.security.dto.Permission)5 User (nl.knaw.huygens.timbuctoo.v5.security.dto.User)5 TypeReference (com.fasterxml.jackson.core.type.TypeReference)2 IOException (java.io.IOException)2 BasicDataSetMetaData (nl.knaw.huygens.timbuctoo.v5.dataset.dto.BasicDataSetMetaData)2 DataSetMetaData (nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSetMetaData)2 AuthorizationUnavailableException (nl.knaw.huygens.timbuctoo.v5.security.exceptions.AuthorizationUnavailableException)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Before (org.junit.Before)1