def add_owning_group(self, group): """Add group as an group owner of this resource""" group = coerce_to_list(group) typecheck_seq(group, HasUserID) self.groups.extend(group) self._p_changed = 1
def set_owner(self, owner): """Set owner as sole owner of this resource. Can use add_owner to add additional owners. """ owner = coerce_to_list(owner) typecheck_seq(owner, HasUserID) self.owners = [] self.add_owner(owner)
def add_owner(self, owner): """Add owner as an owner of this resource""" owner = coerce_to_list(owner)[:] typecheck_seq(owner, HasUserID) to_remove = [] for user in owner: if user in self.owners: to_remove.append(user) for user in to_remove: owner.remove(user) self.owners.extend(owner) self._p_changed = 1
def _consistency_check(self): if self.primary_email is not None: if self.primary_email not in self.__items: raise KeyError, "primary_email not in email list" typecheck_seq(self.__items, str, allow_none=1)
def add_to_group(self, item): item = coerce_to_list(item) typecheck_seq(item, HasUserID) self.__items.extend(item) self.__items = unique_items(self.__items) self._p_changed = 1