Created
January 3, 2015 05:27
-
-
Save xudifsd/70b01fb318d7fd970269 to your computer and use it in GitHub Desktop.
ACL checker before optimization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn self-is-active? | |
[{{:keys [uid]} :params :as req}] | |
(when-not (nil? uid) | |
(let [user-id (u/->int uid) | |
user (users/get-user-by-id user-id)] | |
(when-not (nil? user) | |
(not (:inactive user)))))) | |
(defn self-belongs-to-team? | |
[{{:keys [uid subdomain]} :params :as req}] | |
(when-not (nil? uid) | |
(let [user-id (u/->int uid) | |
user (users/get-user-by-id user-id) | |
team (teams/get-team-by-subdomain subdomain)] | |
(when-not (some nil? [user team]) | |
(= (:team_id user) (:id team)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment