Beispiel #1
0
    def set_kind(self, kind):
        """
        Set the action URI of the privilege.

        :return: The privilege object
        """
        validate_privilege_kind(kind)
        self.the_kind = kind
        return self
Beispiel #2
0
    def __init__(self, name, action, kind, connection=None, save_connection=True):
        validate_privilege_kind(kind)

        self._config = {}
        self._config['privilege-name'] = name
        self._config['action'] = action
        self.the_kind = kind
        self.etag = None
        self.name = name
        self.logger = logging.getLogger("marklogic.privilege")
        self.save_connection = save_connection
        if save_connection:
            self.connection = connection
        else:
            self.connection = None
Beispiel #3
0
    def unmarshal(cls, config):
        """
        Construct a new Privilege from a flat structure. This method is
        principally used to construct an object from a Management API
        payload. The configuration passed in is largely assumed to be
        valid.

        :param: config: A hash of properties
        :return: A newly constructed Privilege object with the specified properties.
        """
        kind = config['kind']
        validate_privilege_kind(kind)

        result = Privilege("temp", "http://example.com/", kind)
        result._config = config
        result.name = config['privilege-name']
        result.the_kind = kind
        return result