Exemplo n.º 1
0
    def can_add_photos_to_tree(self):
        # Users can add photos only if they have all
        # WRITE_DIRECTLY or WRITE_WITH_AUDIT permissions
        # on tree photo
        fields = {'tree', 'image', 'thumbnail', 'id'}

        perms = self.user.get_instance_permissions(
            self.instance, 'TreePhoto')

        fieldperms = {perm.field_name
                      for perm
                      in perms
                      if perm.allows_writes}

        enabled = feature_enabled(self.instance, 'tree_image_upload')
        return enabled and fieldperms == fields
Exemplo n.º 2
0
 def feature_enabled(self, feature):
     return feature_enabled(self, feature)