Created
July 9, 2015 15:11
-
-
Save mmzyk/0fc61cbf621d62469624 to your computer and use it in GitHub Desktop.
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
%% Tells whether this user is the superuser. | |
is_superuser(Req) -> | |
UserName = list_to_binary(wrq:get_req_header("x-ops-userid", Req)), | |
is_superuser(UserName); | |
is_superuser(UserName) -> | |
Superusers = envy:get(oc_chef_wm, superusers, [], list), | |
lists:member(UserName, Superusers). | |
Lines 5 to 7 is the existing function. I want to add lines 2 to 4. How can I make it guard so if it's a webmachine request object, it uses the first fun head and if not otherwise uses the 2nd? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment