Skip to content

Instantly share code, notes, and snippets.

@wildermuthn
Created March 11, 2014 03:28
Show Gist options
  • Save wildermuthn/9478966 to your computer and use it in GitHub Desktop.
Save wildermuthn/9478966 to your computer and use it in GitHub Desktop.
(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