def setPermissions(self, dbName, access) :
        """Grant revoke rights on a database, 'access' is supposed to be boolean. ArangoDB grants/revokes both read and write rights at the same time"""
        import json

        if not self.URL :
            raise CreationError("Please save user first", None, None)

        rights = []
        if access :
            rights.append("rw")

        rights = ''.join(rights)

        if not self.connection.hasDatabase(dbName) :
            raise KeyError("Unknown database: %s" % dbName)

        url = "%s/database/%s" % (self.URL, dbName)
        r = self.connection.session.put(url, data = json.dumps({"grant": rights}, default=str))
        if r.status_code < 200 or r.status_code > 202 :
            raise CreationError("Unable to grant rights", r.content)
def setPermissions ( self , dbName , access ) : import json if not self . URL : raise CreationError ( "Please save user first" , None , None ) rights = [ ] if access : rights . append ( "rw" ) rights = '' . join ( rights ) if not self . connection . hasDatabase ( dbName ) : raise KeyError ( "Unknown database: %s" % dbName ) url = "%s/database/%s" % ( self . URL , dbName ) r = self . connection . session . put ( url , data = json . dumps ( { "grant" : rights } , default = str ) ) if r . status_code < 200 or r . status_code > 202 : raise CreationError ( "Unable to grant rights" , r . content )
Grant revoke rights on a database, 'access' is supposed to be boolean. ArangoDB grants/revokes both read and write rights at the same time