Search in sources :

Example 11 with AccessControlPolicy

use of com.pspace.ifs.ksan.gw.format.AccessControlPolicy in project ksan by infinistor.

the class S3Request method isGrantBucket.

protected boolean isGrantBucket(String id, String s3grant) throws GWException {
    if (getBucketInfo() == null) {
        return false;
    }
    if (accessControlPolicy == null) {
        XmlMapper xmlMapper = new XmlMapper();
        try {
            accessControlPolicy = xmlMapper.readValue(getBucketInfo().getAcl(), AccessControlPolicy.class);
        } catch (JsonMappingException e) {
            logger.error(e.getMessage());
            throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
        } catch (JsonProcessingException e) {
            logger.error(e.getMessage());
            throw new GWException(GWErrorCode.INTERNAL_SERVER_ERROR, s3Parameter);
        }
    }
    logger.info(GWConstants.LOG_REQUEST_CHECK_ACL_ID_GRANT, id, s3grant);
    logger.info(GWConstants.LOG_REQUEST_BUCKET_ACL, getBucketInfo().getAcl());
    logger.info(GWConstants.LOG_REQUEST_BUCKET_OWNER_ID, accessControlPolicy.owner.id);
    if (accessControlPolicy.aclList.grants == null) {
        return false;
    }
    return checkGrant(id, s3grant, accessControlPolicy);
}
Also used : AccessControlPolicy(com.pspace.ifs.ksan.gw.format.AccessControlPolicy) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) GWException(com.pspace.ifs.ksan.gw.exception.GWException) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) XmlMapper(com.fasterxml.jackson.dataformat.xml.XmlMapper)

Aggregations

GWException (com.pspace.ifs.ksan.gw.exception.GWException)11 AccessControlPolicy (com.pspace.ifs.ksan.gw.format.AccessControlPolicy)11 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)9 Grant (com.pspace.ifs.ksan.gw.format.AccessControlPolicy.AccessControlList.Grant)9 XmlMapper (com.fasterxml.jackson.dataformat.xml.XmlMapper)7 AccessControlList (com.pspace.ifs.ksan.gw.format.AccessControlPolicy.AccessControlList)6 Owner (com.pspace.ifs.ksan.gw.format.AccessControlPolicy.Owner)6 S3Bucket (com.pspace.ifs.ksan.gw.identity.S3Bucket)5 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)4 Metadata (com.pspace.ifs.ksan.objmanager.Metadata)4 S3Metadata (com.pspace.ifs.ksan.gw.identity.S3Metadata)3 IOException (java.io.IOException)3 Grantee (com.pspace.ifs.ksan.gw.format.AccessControlPolicy.AccessControlList.Grant.Grantee)2 S3Object (com.pspace.ifs.ksan.gw.object.S3Object)2 S3ObjectOperation (com.pspace.ifs.ksan.gw.object.S3ObjectOperation)2 Writer (java.io.Writer)2 XMLOutputFactory (javax.xml.stream.XMLOutputFactory)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)2