예제 #1
0
    def _validate(self, value):
        """Verify if the specified owner is valid for the logged-in user

        Non-admin users cannot specify admin as the owner

        """
        super()._validate(value)
        permitted_owners = [group[0] for group in contact_group_choices(only_own=True)]
        if user.may("wato.edit_all_passwords"):
            permitted_owners.append("admin")

        if value not in permitted_owners:
            raise self.make_error("invalid", name=value)
예제 #2
0
 def _validate(self, value):
     super()._validate(value)
     shareable_groups = [group[0] for group in contact_group_choices()]
     if value not in ["all", *shareable_groups]:
         raise self.make_error("invalid", name=value)