module Wire::Auth

Auth is a module for handling authorization @author Bryan T. Meyers

Public Instance Methods

actions_allowed(context) click to toggle source

Get the allowed actions for the current URI @param [Hash] context the context for this request @return [Array] the allowed actions for this URI

# File lib/closet/auth.rb, line 25
def actions_allowed(context)
  if context.config['auth_read_only']
    [:read, :readAll]
  elsif context.config['auth_user']
    if context.user == context.config['auth_user']
      [:create, :read, :readAll, :update, :delete]
    else
      []
    end
  elsif context.config['auth_handler']
    context.config['auth_handler'].actions_allowed(context)
  else
    [:create, :read, :readAll, :update, :delete]
  end
end