Esempio n. 1
0
    def remove_principal(self, name, principal):
        """Remove a principal from an ACL.

        :param name: Setting name
        :param principal: A :class:`.User` or a :class:`.GroupProxy`
        """
        self._check_name(name)
        SettingPrincipal.remove_principal(self.module, name, principal)
        self._flush_cache()
Esempio n. 2
0
    def set(self, name, acl):
        """Replace an ACL with a new one.

        :param name: Setting name
        :param acl: A set containing principals (users/groups)
        """
        self._check_name(name)
        SettingPrincipal.set_acl(self.module, name, acl)
        self._flush_cache()
Esempio n. 3
0
    def add_principal(self, name, principal):
        """Add a principal to an ACL.

        :param name: Setting name
        :param principal: A :class:`.User` or a :class:`.GroupProxy`
        """
        self._check_name(name)
        SettingPrincipal.add_principal(self.module, name, principal)
        self._flush_cache()
Esempio n. 4
0
    def remove_principal(self, name, principal):
        """Removes a principal from an ACL

        :param name: Setting name
        :param principal: A :class:`.User` or a :class:`.GroupProxy`
        """
        self._check_name(name)
        SettingPrincipal.remove_principal(self.module, name, principal)
        self._flush_cache()
Esempio n. 5
0
    def set(self, name, acl):
        """Replaces an ACL with a new one

        :param name: Setting name
        :param acl: A set containing principals (users/groups)
        """
        self._check_name(name)
        SettingPrincipal.set_acl(self.module, name, acl)
        self._flush_cache()
Esempio n. 6
0
    def add_principal(self, name, principal):
        """Adds a principal to an ACL

        :param name: Setting name
        :param principal: A :class:`.User` or a :class:`.GroupProxy`
        """
        self._check_name(name)
        SettingPrincipal.add_principal(self.module, name, principal)
        self._flush_cache()
Esempio n. 7
0
    def delete(self, *names):
        """Delete settings.

        :param names: One or more names of settings to delete
        """
        self._split_call(
            names, lambda name: Setting.delete(self.module, *name),
            lambda name: SettingPrincipal.delete(self.module, *name))
        self._flush_cache()
Esempio n. 8
0
    def delete(self, *names):
        """Deletes settings.

        :param names: One or more names of settings to delete
        """
        self._split_call(names,
                         lambda name: Setting.delete(self.module, *name),
                         lambda name: SettingPrincipal.delete(self.module, *name))
        self._flush_cache()
Esempio n. 9
0
    def set_multi(self, items):
        """Sets multiple settings at once.

        :param items: Dict containing the new settings
        """
        self._split_call(items,
                         lambda x: Setting.set_multi(self.module, x),
                         lambda x: SettingPrincipal.set_acl_multi(self.module, x))
        self._flush_cache()
Esempio n. 10
0
    def set_multi(self, items):
        """Sets multiple settings at once.

        :param items: Dict containing the new settings
        """
        self._split_call(
            items, lambda x: Setting.set_multi(self.module, x),
            lambda x: SettingPrincipal.set_acl_multi(self.module, x))
        self._flush_cache()
Esempio n. 11
0
    def set_multi(self, items):
        """Set multiple settings at once.

        :param items: Dict containing the new settings
        """
        items = {k: self._convert_from_python(k, v) for k, v in items.items()}
        self._split_call(
            items, lambda x: Setting.set_multi(self.module, x),
            lambda x: SettingPrincipal.set_acl_multi(self.module, x))
        self._flush_cache()
Esempio n. 12
0
    def set_multi(self, items):
        """Sets multiple settings at once.

        :param items: Dict containing the new settings
        """
        items = {k: self._convert_from_python(k, v) for k, v in items.iteritems()}
        self._split_call(items,
                         lambda x: Setting.set_multi(self.module, x),
                         lambda x: SettingPrincipal.set_acl_multi(self.module, x))
        self._flush_cache()
Esempio n. 13
0
 def delete_all(self):
     """Delete all settings."""
     Setting.delete_all(self.module)
     SettingPrincipal.delete_all(self.module)
     self._flush_cache()
Esempio n. 14
0
 def merge_users(self, target, source):
     """Replace all ACL user entries for `source` with `target`."""
     SettingPrincipal.merge_users(self.module, target, source)
     self._flush_cache()
Esempio n. 15
0
 def merge_users(self, target, source):
     """Replaces all ACL user entries for `source` with `target`"""
     SettingPrincipal.merge_users(self.module, target, source)
     self._flush_cache()
Esempio n. 16
0
 def delete_all(self):
     """Deletes all settings."""
     Setting.delete_all(self.module)
     SettingPrincipal.delete_all(self.module)
     self._flush_cache()