lib/simple_auth/authentication.rb in di-simple_auth-0.3.3 vs lib/simple_auth/authentication.rb in di-simple_auth-0.3.4
- old
+ new
@@ -24,12 +24,12 @@
def current_user
@_current_user ||= user_from_cookie
end
- def current_permission(invoice)
- @_current_permission ||= permission_from_token(invoice)
+ def current_permission(invoice = nil)
+ @_current_permission ||= permission_from_token(invoice)
end
@@ -122,10 +122,10 @@
end
def permission_from_token(invoice)
if params[:token] && _token = params[:token][12..-1]
::Permission.find_by_token(_token)
- elsif current_user
+ elsif current_user && invoice
current_user.permissions(invoice).max_by{|v| v.index }
end
end
def store_location
\ No newline at end of file