Class: Mumukit::Auth::FirstPartGrant

Inherits:
Grant
  • Object
show all
Defined in:
lib/mumukit/auth/grant.rb

Instance Method Summary collapse

Methods inherited from Grant

#==, #as_json, #hash, #inspect, parse, #to_mumukit_grant

Constructor Details

#initialize(first) ⇒ FirstPartGrant

Returns a new instance of FirstPartGrant.



63
64
65
# File 'lib/mumukit/auth/grant.rb', line 63

def initialize(first)
  @first = first.downcase
end

Instance Method Details

#allows?(resource_slug) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/mumukit/auth/grant.rb', line 67

def allows?(resource_slug)
  resource_slug.to_mumukit_slug.normalize!.match_first @first
end

#to_mumukit_slugObject



75
76
77
# File 'lib/mumukit/auth/grant.rb', line 75

def to_mumukit_slug
  Mumukit::Auth::Slug.new @first, '*'
end

#to_sObject



71
72
73
# File 'lib/mumukit/auth/grant.rb', line 71

def to_s
  "#{@first}/*"
end