示例#1
0
    def _putObjectAcl(self):

        self._LOGGER.info("putting the object acl")

        myDict = XmlToDict(self.getBody()).getDict()

        myList = myDict['AccessControlPolicy']['AccessControlList']['Grant']

        grantList = []
        if not type(myList) is types.DictType:
            for grantDict in myList:
                if not grantDict['Grantee'].has_key('ID'):
                    self._LOGGER.warning(
                        'Putting different ACL from the usal CanonicalID, currently not implemented'
                    )
                    raise RestFSError(errCode.err['NotImplemented']['code'],\
                      errCode.err['NotImplemented']['message'],\
                      errCode.err['NotImplemented']['http'])
                grant = Grant()
                grant.uid = grantDict['Grantee']['ID']
                grant.permission = ACPHelper.s3AclToPerm(
                    grantDict['Permission'])
                grantList.append(grant)
        else:
            grant = Grant()
            grant.uid = myList['Grantee']['ID']
            grant.permission = ACPHelper.s3AclToPerm(myList['Permission'])
            grantList.append(grant)

        self.application.objectSrv.putObjectACL(self.s3Request.BUCKET,
                                                self.s3Request.OBJECT,
                                                self.s3Request.ID_REQUEST,
                                                self.getUser(), grantList)

        return None
示例#2
0
    def _putObjectAcl(self):

        self._LOGGER.info("putting the object acl")

        myDict = XmlToDict(self.getBody()).getDict()

        myList = myDict["AccessControlPolicy"]["AccessControlList"]["Grant"]

        grantList = []
        if not type(myList) is types.DictType:
            for grantDict in myList:
                if not grantDict["Grantee"].has_key("ID"):
                    self._LOGGER.warning("Putting different ACL from the usal CanonicalID, currently not implemented")
                    raise RestFSError(
                        errCode.err["NotImplemented"]["code"],
                        errCode.err["NotImplemented"]["message"],
                        errCode.err["NotImplemented"]["http"],
                    )
                grant = Grant()
                grant.uid = grantDict["Grantee"]["ID"]
                grant.permission = ACPHelper.s3AclToPerm(grantDict["Permission"])
                grantList.append(grant)
        else:
            grant = Grant()
            grant.uid = myList["Grantee"]["ID"]
            grant.permission = ACPHelper.s3AclToPerm(myList["Permission"])
            grantList.append(grant)

        self.application.objectSrv.putObjectACL(
            self.s3Request.BUCKET, self.s3Request.OBJECT, self.s3Request.ID_REQUEST, self.getUser(), grantList
        )

        return None
示例#3
0
 def write(self, path, data_handler, offset, fh):
     print '#################'
     print '##### WRITE  ###'
     print '#################'
     uid, gid, context = fuse_get_context()
     xattr = self.listxattr(path)
     object_acl = S3ACP.ACL_FULL_CONTROL
     acp = ACP()
     grant = Grant() 
     grant.uid = uid  
     grant.permission = ACPHelper.s3AclToPerm(object_acl)
     grantList = [grant]
     acp.setByGrants(grantList)
     storage_class="STANDARD"
     content_type=None
     self.cache.write(options.root_bucket, path, uid, gid, context, storage_class, object_acl ,content_type, xattr,  data_handler)
     
     self.data[path] = self.data[path][:offset] + data_handler
     self.files[path]['st_size'] = len(self.data[path])
     return len(data_handler)