lockdown 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.3.6 2008-04-30
2
+ * Fixed: The block in init.rb does not take a parameter. This has been removed from the template.
3
+
1
4
  == 0.3.5 2008-04-30
2
5
  * Added: Basic configuations to config/lockdown/init.rb when using the generator
3
6
 
@@ -1,7 +1,7 @@
1
1
  require "lockdown"
2
2
  require File.join(File.dirname(__FILE__), "session")
3
3
 
4
- Lockdown::System.configure do |c|
4
+ Lockdown::System.configure do
5
5
 
6
6
  #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7
7
  # Configuration Options
@@ -2,7 +2,7 @@ module Lockdown #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- TINY = 5
5
+ TINY = 6
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/website/index.txt CHANGED
@@ -52,117 +52,88 @@ The above list will be stored in the session as an array and each request is tes
52
52
 
53
53
  To define access rights you need to modify lib/lockdown/init.rb. This is the default init.rb included with Lockdown:
54
54
  <pre syntax="ruby">
55
- require "lockdown"
55
+ require "lockdown"
56
+ require File.join(File.dirname(__FILE__), "session")
56
57
 
57
- module Lockdown
58
+ Lockdown::System.configure do
59
+
60
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61
+ # Configuration Options
62
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
63
+ # Options with defaults:
64
+ #
65
+ # Set timeout to 1 hour:
66
+ # options[:session_timeout] = (60 * 60)
67
+ #
68
+ # Set system to logout if unauthorized access is attempted:
69
+ # options[:logout_on_access_violation] = false
70
+ #
71
+ # Set redirect to path on unauthorized access attempt:
72
+ # options[:access_denied_path] = "/"
73
+ #
74
+ # Set redirect to path on successful login:
75
+ # options[:successful_login_path] = "/"
76
+ #
77
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
78
+ # Define permissions
79
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
80
+ #
81
+ # set_permission(:product_management, all_methods(:products))
82
+ #
83
+ # :product_management is the name of the permission which is later
84
+ # referenced by the set_user_group method
85
+ #
86
+ # :all_methods(:products) will return an array of all controller actions
87
+ # for the products controller
88
+ #
89
+ # if products is your standard RESTful resource you'll get:
90
+ # ["products/index , "products/show",
91
+ # "products/new", "products/edit",
92
+ # "products/create", "products/update",
93
+ # "products/destroy"]
58
94
  #
95
+ # You can pass multiple parameters to concat permissions such as:
96
+ #
97
+ # set_permission(:security_management,all_methods(:users),
98
+ # all_methods(:user_groups),
99
+ # all_methods(:permissions) )
59
100
  #
60
- # Permissions are used to group access rights into logical components.
61
- # Each method defined in the Permissions module represents an array
62
- # of methods from a controller (or multiple controllers.)
101
+ # In addition to all_methods(:controller) there are:
102
+ #
103
+ # only_methods(:controller, :only_method_1, :only_method_2)
104
+ #
105
+ # all_except_methods(:controller, :except_method_1, :except_method_2)
106
+ #
107
+ # Some other sample permissions:
63
108
  #
64
- # Controller methods available are:
65
- #
66
- # # Returns all methods from all controllers
67
- # all_controllers
68
- #
69
- # # Returns all methods from all controllers listed
70
- # all_methods :controller1, controller2, ...
71
- #
72
- # # For a single controller, returns only methods listed
73
- # only_methods :controller1, :method1, :method2, ...
74
- #
75
- # # For a single controller, returns all methods except the methods listed
76
- # all_except_methods :controller1, :method1, :method2, ...
77
- #
78
- # They all return an array of controller/action. For example, if you had a
79
- # standard REST controller called products this would be the result:
80
- #
81
- #
82
- # all_methods :products => [ "products/index , "products/show",
83
- # "products/new", "products/edit",
84
- # "products/create", "products/update",
85
- # "products/destroy"]
86
- #
87
- module Permissions
88
- class << self
89
-
90
- def sessions_management
91
- # all_methods :sessions
92
- end
93
-
94
- end # end class block
95
- end # end Permissions module
96
-
97
- #
98
- # UserGroups are used to group Permissions together to define role type
99
- # functionality. Users may belong to multiple groups.
109
+ # set_permission(:sessions, all_methods(:sessions))
110
+ # set_permission(:my_account, only_methods(:users, :edit, :update, :show))
100
111
  #
101
- module UserGroups
102
- class << self
103
-
104
- #
105
- # This method defines which UserGroups cannot be managed
106
- # via the management screens.
107
- #
108
- # Users can still be assigned to these groups.
109
- #
110
- def private_records
111
- [:administrators]
112
- end
113
- #
114
- # This method defines which UserGroups have limited access
115
- # via the management screens. Deletion is not allowed.
116
- #
117
- # Users can still be assigned to these groups.
118
- #
119
- def protected_records
120
- [:public_access, :registered_users]
121
- end
122
-
123
- # ** The administrator method is "special", please don't rename.
124
- # If you remove/rename, etc... YOU WILL BREAK STUFF
125
- #
126
- # Standard administrator user group.
127
- # Please don't alter without careful consideration.
128
- #
129
- def administrators
130
- [:all]
131
- end
132
-
133
- # ** The public_access method is "special", please don't rename.
134
- # If you remove/rename, etc... YOU WILL BREAK STUFF
135
- #
136
- # Standard public_access user group.
137
- #
138
- # Feel free to add Permissions to the array without issue.
139
- #
140
- # **Notice: All permissions added to this public_access group will not be
141
- # restricted to logged in users.
142
- # So be careful what you add here!
143
- #
144
- def public_access
145
- [:sessions_management]
146
- end
147
-
148
- # ** The registered_users method is "special", please don't rename.
149
- # Not as special as the others, but still...
150
- #
151
- # All newly created users are assigned to this User Group by default
152
- #
153
- # Sample registered_users permission:
154
- # [:my_account]
155
- #
156
- def registered_users
157
- []
158
- end
159
-
160
- #
161
- # Define your own user groups below
162
- #
163
- end # end class block
164
- end # end UserGroups module
165
- end # end Lockdown module
112
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
113
+ # Built-in user groups
114
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
115
+ # You can assign the above permission to one of the built-in user groups
116
+ # by using the following:
117
+ #
118
+ # To allow public access on the permissions :sessions and :home:
119
+ # set_public_access :sessions, :home
120
+ #
121
+ # Restrict :my_account access to only authenticated users:
122
+ # set_protected_access :my_account
123
+ #
124
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
125
+ # Define user groups
126
+ #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
127
+ #
128
+ # set_user_group(:catalog_management, :category_management,
129
+ # :product_management)
130
+ #
131
+ # :catalog_management is the name of the user group
132
+ # :category_management and :product_management refer to permission names
133
+ #
134
+
135
+ # Add your configuration below:
136
+ end
166
137
  </pre>
167
138
 
168
139
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lockdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Stone