Skip to content

Commit

Permalink
Merge pull request #26 from ianmcorvidae/core-1996
Browse files Browse the repository at this point in the history
CORE-1996: enqueue group propagation messages for member operations
  • Loading branch information
ianmcorvidae authored May 31, 2024
2 parents fc4d0ea + 250942f commit 2844b25
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions src/iplant_groups/service/groups.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
(amqp/publish-msg (str "index.group." id) "")
group)

(defn- enqueue-group-propagation-by-name
[group-name user]
(when-let [group (grouper/get-group user group-name)]
(enqueue-group-propagation (fmt/format-group group))))

(defn group-search
[{:keys [user search folder details]}]
(let [results (grouper/group-search user folder search details)
Expand Down Expand Up @@ -90,25 +95,31 @@

(defn replace-members
[group-name {:keys [members]} {:keys [user]}]
{:results (mapv fmt/format-member-subject-update-response
(grouper/replace-group-members user group-name members))})
(let [ret (grouper/replace-group-members user group-name members)]
(future (enqueue-group-propagation-by-name group-name user))
{:results (mapv fmt/format-member-subject-update-response ret)}))

(defn add-members
[group-name {:keys [members]} {:keys [user]}]
(grouper/add-group-members user group-name members)
{:results (mapv fmt/format-member-subject-update-response
(grouper/add-group-members user group-name members))})
(let [ret (grouper/add-group-members user group-name members)]
(future (enqueue-group-propagation-by-name group-name user))
{:results (mapv fmt/format-member-subject-update-response ret)}))

(defn remove-members
[group-name {:keys [members]} {:keys [user]}]
(grouper/remove-group-members user group-name members)
{:results (mapv fmt/format-member-subject-update-response
(grouper/remove-group-members user group-name members))})
(let [ret (grouper/remove-group-members user group-name members)]
(future (enqueue-group-propagation-by-name group-name user))
{:results (mapv fmt/format-member-subject-update-response ret)}))

(defn add-member
[group-name subject-id {:keys [user]}]
(grouper/add-group-member user group-name subject-id))
(let [ret (grouper/add-group-member user group-name subject-id)]
(future (enqueue-group-propagation-by-name group-name user))
ret))


(defn remove-member
[group-name subject-id {:keys [user]}]
(grouper/remove-group-member user group-name subject-id))
(let [ret (grouper/remove-group-member user group-name subject-id)]
(future (enqueue-group-propagation-by-name group-name user))
ret))

0 comments on commit 2844b25

Please sign in to comment.