Class: Htpasswd::Acls::Base
- Inherits:
-
Object
- Object
- Htpasswd::Acls::Base
show all
- Defined in:
- lib/htpasswd/acls/base.rb
Constant Summary
collapse
- @@entries =
{}
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options) ⇒ Base
Returns a new instance of Base.
19
20
21
|
# File 'lib/htpasswd/acls/base.rb', line 19
def initialize(options)
@options = options
end
|
Class Method Details
.[](name) ⇒ Object
9
10
11
12
|
# File 'lib/htpasswd/acls/base.rb', line 9
def [](name)
name = name.to_s.classify
@@entries[name] or raise UnknownAccessControl, name
end
|
.register(klass) ⇒ Object
14
15
16
|
# File 'lib/htpasswd/acls/base.rb', line 14
def register(klass)
@@entries[klass.name.demodulize.classify] = klass
end
|
Instance Method Details
#authorize_pass(scheme) ⇒ Object
47
48
49
|
# File 'lib/htpasswd/acls/base.rb', line 47
def authorize_pass(scheme)
scheme.authorize_pass(pass)
end
|
#authorize_type(scheme) ⇒ Object
39
40
41
|
# File 'lib/htpasswd/acls/base.rb', line 39
def authorize_type(scheme)
scheme.authorize_type(type)
end
|
#authorize_user(scheme) ⇒ Object
43
44
45
|
# File 'lib/htpasswd/acls/base.rb', line 43
def authorize_user(scheme)
scheme.authorize_user(user)
end
|
#authorized?(scheme) ⇒ Boolean
35
36
37
|
# File 'lib/htpasswd/acls/base.rb', line 35
def authorized?(scheme)
authorize_type(scheme) && authorize_user(scheme) && authorize_pass(scheme) && scheme.user
end
|
#pass ⇒ Object
27
28
29
|
# File 'lib/htpasswd/acls/base.rb', line 27
def pass
@options[:pass]
end
|
#type ⇒ Object
31
32
33
|
# File 'lib/htpasswd/acls/base.rb', line 31
def type
@options[:type]
end
|
#user ⇒ Object
23
24
25
|
# File 'lib/htpasswd/acls/base.rb', line 23
def user
@options[:user]
end
|