     
     false)) ; it's OK if there is no org to delete
 
+;; ----- Org's set operations -----
+
+(schema/defn ^:always-validate add-author :- (schema/maybe common/Org)
+  "
+  Given the slug of the org, and the user-id of the user, add the user as an author of the org if it exists.
+  Returns the updated org on success, nil on non-existence, and a RethinkDB error map on other errors.
+  "
+  [conn slug user-id :- lib-schema/UniqueID]
+  {:pre [(db-common/conn? conn)
+         (slug/valid-slug? slug)]}
+  (when-let* [org (get-org conn slug)]
+    (db-common/add-to-set conn table-name slug "authors" user-id)))
+
+(schema/defn ^:always-validate remove-author :- (schema/maybe common/Org)
+  "
+  Given the slug of the org, and the user-id of the user, remove the user as an author of the org if it exists.
+  Returns the updated org on success, nil on non-existence, and a RethinkDB error map on other errors.
+  "
+  [conn slug user-id :- lib-schema/UniqueID]
+  {:pre [(db-common/conn? conn)
+         (slug/valid-slug? slug)]}
+  (if-let [org (get-org conn slug)]
+    (db-common/remove-from-set conn table-name slug "authors" user-id)))
+
 ;; ----- Collection of orgs -----
 
 (defn list-orgs

  Secondary indexes:
  `uuid`
  `team-id`
  `admins`
  "
  [conn index-key v]
  {:pre [(db-common/conn? conn)

(ns oc.storage.resources.org
  (:require [clojure.walk :refer (keywordize-keys)]
            [if-let.core :refer (when-let*)]
            [schema.core :as schema]
            [oc.lib.slugify :as slug]
            [oc.lib.schema :as lib-schema]
