app/models/user.rb
# Return whether or not the user is authorized at the given level of
# permission
Return whether or not the user is authorized at the given level of
permission
Return whether or not the user is authorized at the given level of permission
def authorized?(level)
    rank = {
      ROLE_UNAPPROVED => 0,
      ROLE_MEMBER	    => 1,
      ROLE_EDITOR	    => 2,
      ROLE_ADMIN	    => 3
    }
    rank[role] >= rank[level]
  end
def authorized? ( level ) rank = { ROLE_UNAPPROVED => 0 , ROLE_MEMBER => 1 , ROLE_EDITOR => 2 , ROLE_ADMIN => 3 } rank [ role ] >= rank [ level ] end
Return whether or not the user is authorized at the given level of
permission
Return whether or not the user is authorized at the given level of permission
# TODO: roles should probably be refactored into their own class
level
<not_specific>