lib/ddr/auth/auth_context.rb in ddr-models-2.11.0 vs lib/ddr/auth/auth_context.rb in ddr-models-3.0.0.alpha.1
- old
+ new
@@ -7,24 +7,10 @@
def initialize(user = nil, env = nil)
@user = user
@env = env
end
- def ability
- if anonymous?
- AnonymousAbility.new(self)
- elsif superuser?
- SuperuserAbility.new(self)
- else
- default_ability_class.new(self)
- end
- end
-
- def default_ability_class
- Ddr::Auth::default_ability.constantize
- end
-
# Return whether a user is absent from the auth context.
# @return [Boolean]
def anonymous?
user.nil?
end
@@ -37,13 +23,9 @@
# Return whether context is authenticated in superuser scope.
# @return [Boolean]
def superuser?
env && env.key?("warden") && env["warden"].authenticate?(scope: :superuser)
- end
-
- def metadata_manager?
- member_of? Ddr::Auth.metadata_managers_group
end
# Return the user agent for this context.
# @return [String] or nil, if auth context is anonymous/
def agent