Created
March 11, 2014 03:28
-
-
Save wildermuthn/9478966 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
(defun check-permission (user verb noun params) | |
(let ((verb (intern (string-upcase verb))) | |
(noun (intern (string-upcase noun)))) | |
(if (equal verb 'remove) (setf verb 'delete)) | |
(let ((perm (member noun (getf (gethash user *user-permissions*) verb) :test #'equal))) | |
(or (member (getf params :type) (getf perm noun) :test #'equal) (equal '(all) (getf perm noun)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment