role_based_authorization 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/{README → README.rdoc} +13 -8
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/role_based_authorization.gemspec +3 -3
- metadata +3 -3
data/{README → README.rdoc}
RENAMED
@@ -1,15 +1,20 @@
|
|
1
1
|
= RoleBasedAuthorization
|
2
2
|
|
3
3
|
|
4
|
-
This
|
4
|
+
This library provide a very simple authorization system. It should work fine with
|
5
5
|
most of the authentication plugins (and gems) out there, even though little testing
|
6
6
|
has been done in this regard. There are a lot of similar plugin/gems and probably
|
7
|
-
this is not better than any others (see
|
7
|
+
this is not better than any others (see http://steffenbartsch.com/blog/2008/08/rails-authorization-plugins/
|
8
|
+
for a nice review).
|
8
9
|
|
9
10
|
Installation:
|
10
|
-
* install the
|
11
|
-
|
12
|
-
|
11
|
+
* install the role_based_authorization by issuing:
|
12
|
+
gem install role_based_authorization
|
13
|
+
or by adding
|
14
|
+
config.gem "role_based_authorization"
|
15
|
+
to your rails config file and then running 'rake gems:install'
|
16
|
+
|
17
|
+
|
13
18
|
* in your application controller: include the module RoleBasedAuthorization:
|
14
19
|
|
15
20
|
class ApplicationController < ActionController::Base
|
@@ -26,7 +31,7 @@ The inclusion of RoleBasedAuthorization serves three purposes: it allows subclas
|
|
26
31
|
== Requirements
|
27
32
|
|
28
33
|
|
29
|
-
The
|
34
|
+
The library poses few and very reasonable constraints on your application. Namely, it requires:
|
30
35
|
|
31
36
|
|
32
37
|
* that your controllers provide a 'current_user' method
|
@@ -39,7 +44,7 @@ The plugin poses few and very reasonable constraints on your application. Namely
|
|
39
44
|
|
40
45
|
You can specify your authorization logic by adding a number of 'permit' calls to your controllers. Permissions granted in a controller apply to all its subclasses. Since usually all controllers inherit from the application controller, this allows one to authorize all actions for the 'admin' role by telling it so in the application controller.
|
41
46
|
|
42
|
-
An important thing to keep in mind is that
|
47
|
+
An important thing to keep in mind is that role_based_authorization assumes that EVERYTHING IS FORBIDDEN unless otherwise specified. Then, if you do not specify any permission rule, you will end up with a very secure (though useless) application.
|
43
48
|
|
44
49
|
The permission statement takes the form:
|
45
50
|
|
@@ -71,7 +76,7 @@ permit options:
|
|
71
76
|
|
72
77
|
== authorized?
|
73
78
|
|
74
|
-
The
|
79
|
+
The library adds an authorized? method to your application controller. The method returns false if one of the following conditions occur:
|
75
80
|
* your controller defines a logged_in? method and the method returns false
|
76
81
|
* no permit rule matches the current settings
|
77
82
|
|
data/Rakefile
CHANGED
@@ -18,7 +18,7 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
18
18
|
rdoc.rdoc_dir = 'rdoc'
|
19
19
|
rdoc.title = 'RoleBasedAuthorization'
|
20
20
|
rdoc.options << '--line-numbers' << '--inline-source'
|
21
|
-
rdoc.rdoc_files.include('README')
|
21
|
+
rdoc.rdoc_files.include('README.rdoc')
|
22
22
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
23
23
|
end
|
24
24
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{role_based_authorization}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Roberto Esposito"]
|
@@ -13,12 +13,12 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.description = %q{Provides a simple DSL for specifying the authorization logic of your application. Install the gem, add a role attribute to your user model and your almost ready to go.}
|
14
14
|
s.email = %q{boborbt@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
|
-
"README"
|
16
|
+
"README.rdoc"
|
17
17
|
]
|
18
18
|
s.files = [
|
19
19
|
".gitignore",
|
20
20
|
"MIT-LICENSE",
|
21
|
-
"README",
|
21
|
+
"README.rdoc",
|
22
22
|
"Rakefile",
|
23
23
|
"VERSION",
|
24
24
|
"lib/role_based_authorization.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: role_based_authorization
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Esposito
|
@@ -20,11 +20,11 @@ executables: []
|
|
20
20
|
extensions: []
|
21
21
|
|
22
22
|
extra_rdoc_files:
|
23
|
-
- README
|
23
|
+
- README.rdoc
|
24
24
|
files:
|
25
25
|
- .gitignore
|
26
26
|
- MIT-LICENSE
|
27
|
-
- README
|
27
|
+
- README.rdoc
|
28
28
|
- Rakefile
|
29
29
|
- VERSION
|
30
30
|
- lib/role_based_authorization.rb
|