 
 (defn delete-badge! [ctx id  user-id subject message]
   (try+
-   (let [user-id (select-user-id-by-badge-id {:id id}(into {:result-set-fn first :row-fn :user_id} (get-db ctx)))
+   (let [user-id (select-user-id-by-badge-id {:id id} (into {:result-set-fn first :row-fn :user_id} (get-db ctx)))
          user (select-user-and-email {:id user-id} (into {:result-set-fn first} (get-db ctx)))]
      (m/send-mail ctx subject message [(:email user)])
      (update-badge-deleted! {:id id} (get-db ctx)))

    user))

(defn set-fake-session [ctx ok-status user-id real-user-id]
  (let [{:keys [role id private activated]} (user-information ctx user-id)]
    (log/info "admin-id: " real-user-id " is login as user-id: " user-id)
    (assoc-in ok-status [:session :identity] {:id id :role role :private private :activated activated :real-id real-user-id})

    )
  )

(defn set-session [ctx ok-status user-id]
  (let [{:keys [role id private activated]} (user-information ctx user-id)]
    (log/info "admin-id: " user-id " logged out from user")
    (assoc-in ok-status [:session :identity] {:id id :role role :private private :activated activated})))

(defn update-user-to-admin [ctx user-id]
  (log/info "admin set user-id: " user-id "to admin.")
  (update-user-to-admin! {:id user-id} (get-db ctx))
  "success"
  )

(defn update-admin-to-user [ctx user-id]
  (log/info "admin set user-id:" user-id "to admin.")
  (update-admin-to-user! {:id user-id} (get-db ctx))
  )

                     :activated (:activated user)
                     :has_password? (:has_password user)
                     :service user-services})))

(defn get-badge-modal [ctx badgeid]
  (let [badge  (b/get-badge ctx badgeid nil)
