module Mumukit::Auth::Protection
Public Instance Methods
protect!(role, slug)
click to toggle source
# File lib/mumukit/auth/protection.rb, line 2 def protect!(role, slug) raise Mumukit::Auth::UnauthorizedAccessError, "Unauthorized access to #{slug} as #{role}. Scope is `#{scope_for role}`" unless has_permission?(role, slug) end
protect_delegation!(other)
click to toggle source
# File lib/mumukit/auth/protection.rb, line 7 def protect_delegation!(other) other ||= {} raise Mumukit::Auth::UnauthorizedAccessError, "Unauthorized delegation to #{other.to_h}" unless delegate_to?(Mumukit::Auth::Permissions.parse(other.to_h)) end