 
 (defn grant-org-perm
   "Grants permission for given User on Org.  Creates record if needed, otherwise updates existing record."
-  [user-id org-id is-admin]
+  [org-id user-id is-admin]
   (let [perm (sel :one OrgPerm :user_id user-id :organization_id org-id)]
     (if-not perm
       (ins OrgPerm

                            :is_staff true
                            :is_active true
                            :is_superuser false)]
          (grant-org-perm (:id new-user-id) (:id org) (:admin body))
          ;; TODO - send signup email
          (-> (sel :one OrgPerm :user_id (:id new-user-id) :organization_id (:id org))
            (hydrate :user :organization)))
        (do
          (grant-org-perm (:id user) (:id org) (:admin body))
          (-> (sel :one OrgPerm :user_id (:id user) :organization_id (:id org))
              (hydrate :user :organization)))))))



(defendpoint GET "/:id/members" [id]
  ;; TODO - permissions check
  (let-404 [org (sel :one Org :id id)]
    (-> (sel :many OrgPerm :organization_id id)
      ;; TODO - we need a way to remove :organization_id and user_id from this output
      (hydrate :user :organization))))
