the_role 2.5.4 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +178 -526
  3. data/gem_version.rb +3 -0
  4. data/lib/the_role/version.rb +1 -3
  5. data/lib/the_role.rb +3 -41
  6. data/the_role.gemspec +5 -5
  7. metadata +20 -231
  8. data/.ruby-gemset.example +0 -1
  9. data/.ruby-version.example +0 -1
  10. data/.rvmrc.example +0 -1
  11. data/.travis.yml +0 -5
  12. data/Bye_bye_CanCan_I_got_the_Role.png +0 -0
  13. data/app/controllers/admin/role_sections_controller.rb +0 -90
  14. data/app/controllers/admin/roles_controller.rb +0 -74
  15. data/app/controllers/concerns/controller.rb +0 -23
  16. data/app/models/_templates_/role.rb +0 -3
  17. data/app/models/concerns/base.rb +0 -37
  18. data/app/models/concerns/role.rb +0 -156
  19. data/app/models/concerns/user.rb +0 -57
  20. data/config/locales/en.yml +0 -44
  21. data/config/locales/es.yml +0 -42
  22. data/config/locales/nl.yml +0 -44
  23. data/config/locales/pl.yml +0 -43
  24. data/config/locales/pt_BR.yml +0 -43
  25. data/config/locales/ru.yml +0 -43
  26. data/config/locales/zh_CN.yml +0 -42
  27. data/config/routes.rb +0 -23
  28. data/db/migrate/20111025025129_create_roles.rb +0 -23
  29. data/docs/2.1.1.png +0 -0
  30. data/lib/generators/the_role/USAGE +0 -32
  31. data/lib/generators/the_role/templates/the_role.rb +0 -11
  32. data/lib/generators/the_role/the_role_generator.rb +0 -64
  33. data/lib/tasks/roles.rake +0 -137
  34. data/lib/the_role/activerecord.rb +0 -11
  35. data/lib/the_role/config.rb +0 -30
  36. data/lib/the_role/hash.rb +0 -58
  37. data/lib/the_role/the_class_exists.rb +0 -8
  38. data/pic.png +0 -0
  39. data/spec/dummy_app/.gitignore +0 -18
  40. data/spec/dummy_app/.rspec +0 -1
  41. data/spec/dummy_app/Gemfile +0 -43
  42. data/spec/dummy_app/README.md +0 -39
  43. data/spec/dummy_app/Rakefile +0 -6
  44. data/spec/dummy_app/app/assets/images/.keep +0 -0
  45. data/spec/dummy_app/app/assets/javascripts/application.js +0 -17
  46. data/spec/dummy_app/app/assets/stylesheets/app/style.css.scss +0 -23
  47. data/spec/dummy_app/app/assets/stylesheets/application.css +0 -3
  48. data/spec/dummy_app/app/controllers/application_controller.rb +0 -38
  49. data/spec/dummy_app/app/controllers/concerns/.keep +0 -0
  50. data/spec/dummy_app/app/controllers/pages_controller.rb +0 -75
  51. data/spec/dummy_app/app/controllers/users_controller.rb +0 -32
  52. data/spec/dummy_app/app/controllers/welcome_controller.rb +0 -13
  53. data/spec/dummy_app/app/helpers/application_helper.rb +0 -2
  54. data/spec/dummy_app/app/mailers/.keep +0 -0
  55. data/spec/dummy_app/app/models/.keep +0 -0
  56. data/spec/dummy_app/app/models/concerns/.keep +0 -0
  57. data/spec/dummy_app/app/models/page.rb +0 -24
  58. data/spec/dummy_app/app/models/role.rb +0 -4
  59. data/spec/dummy_app/app/models/user.rb +0 -21
  60. data/spec/dummy_app/app/views/layouts/_current_user_info.html.haml +0 -17
  61. data/spec/dummy_app/app/views/layouts/application.html.haml +0 -68
  62. data/spec/dummy_app/app/views/pages/_form.html.haml +0 -19
  63. data/spec/dummy_app/app/views/pages/edit.html.haml +0 -7
  64. data/spec/dummy_app/app/views/pages/index.html.haml +0 -27
  65. data/spec/dummy_app/app/views/pages/manage.html.haml +0 -23
  66. data/spec/dummy_app/app/views/pages/my.html.haml +0 -10
  67. data/spec/dummy_app/app/views/pages/new.html.haml +0 -5
  68. data/spec/dummy_app/app/views/pages/show.html.haml +0 -15
  69. data/spec/dummy_app/app/views/users/edit.html.haml +0 -34
  70. data/spec/dummy_app/app/views/welcome/index.html.haml +0 -38
  71. data/spec/dummy_app/app/views/welcome/profile.html.haml +0 -2
  72. data/spec/dummy_app/bin/bundle +0 -3
  73. data/spec/dummy_app/bin/rails +0 -4
  74. data/spec/dummy_app/bin/rake +0 -4
  75. data/spec/dummy_app/config/application.rb +0 -25
  76. data/spec/dummy_app/config/boot.rb +0 -4
  77. data/spec/dummy_app/config/database.yml +0 -17
  78. data/spec/dummy_app/config/environment.rb +0 -5
  79. data/spec/dummy_app/config/environments/development.rb +0 -29
  80. data/spec/dummy_app/config/environments/production.rb +0 -80
  81. data/spec/dummy_app/config/environments/test.rb +0 -36
  82. data/spec/dummy_app/config/initializers/backtrace_silencers.rb +0 -7
  83. data/spec/dummy_app/config/initializers/devise.rb +0 -227
  84. data/spec/dummy_app/config/initializers/filter_parameter_logging.rb +0 -4
  85. data/spec/dummy_app/config/initializers/inflections.rb +0 -16
  86. data/spec/dummy_app/config/initializers/mime_types.rb +0 -5
  87. data/spec/dummy_app/config/initializers/secret_token.rb +0 -12
  88. data/spec/dummy_app/config/initializers/session_store.rb +0 -3
  89. data/spec/dummy_app/config/initializers/the_role.rb +0 -6
  90. data/spec/dummy_app/config/initializers/wrap_parameters.rb +0 -14
  91. data/spec/dummy_app/config/locales/devise.en.yml +0 -57
  92. data/spec/dummy_app/config/locales/en.yml +0 -7
  93. data/spec/dummy_app/config/locales/ru.yml +0 -4
  94. data/spec/dummy_app/config/routes.rb +0 -26
  95. data/spec/dummy_app/config.ru +0 -4
  96. data/spec/dummy_app/db/migrate/20120212061952_devise_create_users.rb +0 -63
  97. data/spec/dummy_app/db/migrate/20120212063249_create_roles.rb +0 -18
  98. data/spec/dummy_app/db/migrate/20120314061307_create_pages.rb +0 -14
  99. data/spec/dummy_app/db/schema.rb +0 -59
  100. data/spec/dummy_app/db/seeds.rb +0 -85
  101. data/spec/dummy_app/lib/assets/.keep +0 -0
  102. data/spec/dummy_app/lib/tasks/.keep +0 -0
  103. data/spec/dummy_app/lib/tasks/assets.rake +0 -15
  104. data/spec/dummy_app/lib/tasks/db_bootstrap.rake +0 -16
  105. data/spec/dummy_app/log/.keep +0 -0
  106. data/spec/dummy_app/public/404.html +0 -58
  107. data/spec/dummy_app/public/422.html +0 -58
  108. data/spec/dummy_app/public/500.html +0 -57
  109. data/spec/dummy_app/public/favicon.ico +0 -0
  110. data/spec/dummy_app/public/robots.txt +0 -5
  111. data/spec/dummy_app/spec/controllers/admin_roles_controller_spec.rb +0 -52
  112. data/spec/dummy_app/spec/controllers/pages_controller_spec.rb +0 -141
  113. data/spec/dummy_app/spec/controllers/welcome_controller_spec.rb +0 -66
  114. data/spec/dummy_app/spec/factories/page.rb +0 -6
  115. data/spec/dummy_app/spec/factories/role.rb +0 -55
  116. data/spec/dummy_app/spec/factories/user.rb +0 -11
  117. data/spec/dummy_app/spec/models/hash_spec.rb +0 -272
  118. data/spec/dummy_app/spec/models/param_process_spec.rb +0 -39
  119. data/spec/dummy_app/spec/models/role_spec.rb +0 -218
  120. data/spec/dummy_app/spec/models/user_spec.rb +0 -164
  121. data/spec/dummy_app/spec/routing/admin_roles_routing_spec.rb +0 -41
  122. data/spec/dummy_app/spec/routing/pages_routing_spec.rb +0 -35
  123. data/spec/dummy_app/spec/spec_helper.rb +0 -68
  124. data/spec/dummy_app/vendor/assets/javascripts/.keep +0 -0
  125. data/spec/dummy_app/vendor/assets/stylesheets/.keep +0 -0
  126. data/the_role.yml.teamocil.example +0 -11
@@ -1,227 +0,0 @@
1
- # Use this hook to configure devise mailer, warden hooks and so forth.
2
- # Many of these configuration options can be set straight in your model.
3
- Devise.setup do |config|
4
- config.router_name = :main_app
5
-
6
- config.secret_key = '828ff2a1001958fd6c0cea946e9807fe9bca809e4745fd5c9b2334d1190e16fe17ba281c6cdeecda4eeb9af9de6cb77b93bf9b0c7fcc5fa6e7f737e204e118e6'
7
-
8
- # ==> Mailer Configuration
9
- # Configure the e-mail address which will be shown in Devise::Mailer,
10
- # note that it will be overwritten if you use your own mailer class with default "from" parameter.
11
- config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
12
-
13
- # Configure the class responsible to send e-mails.
14
- # config.mailer = "Devise::Mailer"
15
-
16
- # Automatically apply schema changes in tableless databases
17
- # config.apply_schema = false
18
-
19
- # ==> ORM configuration
20
- # Load and configure the ORM. Supports :active_record (default) and
21
- # :mongoid (bson_ext recommended) by default. Other ORMs may be
22
- # available as additional gems.
23
- require 'devise/orm/active_record'
24
-
25
- # ==> Configuration for any authentication mechanism
26
- # Configure which keys are used when authenticating a user. The default is
27
- # just :email. You can configure it to use [:username, :subdomain], so for
28
- # authenticating a user, both parameters are required. Remember that those
29
- # parameters are used only when authenticating and not when retrieving from
30
- # session. If you need permissions, you should implement that in a before filter.
31
- # You can also supply a hash where the value is a boolean determining whether
32
- # or not authentication should be aborted when the value is not present.
33
- # config.authentication_keys = [ :email ]
34
-
35
- # Configure parameters from the request object used for authentication. Each entry
36
- # given should be a request method and it will automatically be passed to the
37
- # find_for_authentication method and considered in your model lookup. For instance,
38
- # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
39
- # The same considerations mentioned for authentication_keys also apply to request_keys.
40
- # config.request_keys = []
41
-
42
- # Configure which authentication keys should be case-insensitive.
43
- # These keys will be downcased upon creating or modifying a user and when used
44
- # to authenticate or find a user. Default is :email.
45
- config.case_insensitive_keys = [ :email ]
46
-
47
- # Configure which authentication keys should have whitespace stripped.
48
- # These keys will have whitespace before and after removed upon creating or
49
- # modifying a user and when used to authenticate or find a user. Default is :email.
50
- config.strip_whitespace_keys = [ :email ]
51
-
52
- # Tell if authentication through request.params is enabled. True by default.
53
- # It can be set to an array that will enable params authentication only for the
54
- # given strategies, for example, `config.params_authenticatable = [:database]` will
55
- # enable it only for database (email + password) authentication.
56
- # config.params_authenticatable = true
57
-
58
- # Tell if authentication through HTTP Basic Auth is enabled. False by default.
59
- # It can be set to an array that will enable http authentication only for the
60
- # given strategies, for example, `config.http_authenticatable = [:token]` will
61
- # enable it only for token authentication.
62
- # config.http_authenticatable = false
63
-
64
- # If http headers should be returned for AJAX requests. True by default.
65
- # config.http_authenticatable_on_xhr = true
66
-
67
- # The realm used in Http Basic Authentication. "Application" by default.
68
- # config.http_authentication_realm = "Application"
69
-
70
- # It will change confirmation, password recovery and other workflows
71
- # to behave the same regardless if the e-mail provided was right or wrong.
72
- # Does not affect registerable.
73
- # config.paranoid = true
74
-
75
- # By default Devise will store the user in session. You can skip storage for
76
- # :http_auth and :token_auth by adding those symbols to the array below.
77
- # Notice that if you are skipping storage for all authentication paths, you
78
- # may want to disable generating routes to Devise's sessions controller by
79
- # passing :skip => :sessions to `devise_for` in your config/routes.rb
80
- config.skip_session_storage = [:http_auth]
81
-
82
- # ==> Configuration for :database_authenticatable
83
- # For bcrypt, this is the cost for hashing the password and defaults to 10. If
84
- # using other encryptors, it sets how many times you want the password re-encrypted.
85
- #
86
- # Limiting the stretches to just one in testing will increase the performance of
87
- # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
88
- # a value less than 10 in other environments.
89
- config.stretches = Rails.env.test? ? 1 : 10
90
-
91
- # Setup a pepper to generate the encrypted password.
92
- # config.pepper = "bd420e8b4db2240dfc96eb3b958dcbbef5ffa78cd99e22f9215df3b91c2cd84cf116697fb430f3b9eea58e6f14248a390b0ee2af24aa9dc35d40b819cd34e2b9"
93
-
94
- # ==> Configuration for :confirmable
95
- # A period that the user is allowed to access the website even without
96
- # confirming his account. For instance, if set to 2.days, the user will be
97
- # able to access the website for two days without confirming his account,
98
- # access will be blocked just in the third day. Default is 0.days, meaning
99
- # the user cannot access the website without confirming his account.
100
- # config.allow_unconfirmed_access_for = 2.days
101
-
102
- # If true, requires any email changes to be confirmed (exctly the same way as
103
- # initial account confirmation) to be applied. Requires additional unconfirmed_email
104
- # db field (see migrations). Until confirmed new email is stored in
105
- # unconfirmed email column, and copied to email column on successful confirmation.
106
- config.reconfirmable = true
107
-
108
- # Defines which key will be used when confirming an account
109
- # config.confirmation_keys = [ :email ]
110
-
111
- # ==> Configuration for :rememberable
112
- # The time the user will be remembered without asking for credentials again.
113
- # config.remember_for = 2.weeks
114
-
115
- # If true, extends the user's remember period when remembered via cookie.
116
- # config.extend_remember_period = false
117
-
118
- # If true, uses the password salt as remember token. This should be turned
119
- # to false if you are not using database authenticatable.
120
- # config.use_salt_as_remember_token = true
121
-
122
- # Options to be passed to the created cookie. For instance, you can set
123
- # :secure => true in order to force SSL only cookies.
124
- # config.cookie_options = {}
125
-
126
- # ==> Configuration for :validatable
127
- # Range for password length. Default is 6..128.
128
- # config.password_length = 6..128
129
-
130
- # Email regex used to validate email formats. It simply asserts that
131
- # an one (and only one) @ exists in the given string. This is mainly
132
- # to give user feedback and not to assert the e-mail validity.
133
- # config.email_regexp = /\A[^@]+@[^@]+\z/
134
-
135
- # ==> Configuration for :timeoutable
136
- # The time you want to timeout the user session without activity. After this
137
- # time the user will be asked for credentials again. Default is 30 minutes.
138
- # config.timeout_in = 30.minutes
139
-
140
- # ==> Configuration for :lockable
141
- # Defines which strategy will be used to lock an account.
142
- # :failed_attempts = Locks an account after a number of failed attempts to sign in.
143
- # :none = No lock strategy. You should handle locking by yourself.
144
- # config.lock_strategy = :failed_attempts
145
-
146
- # Defines which key will be used when locking and unlocking an account
147
- # config.unlock_keys = [ :email ]
148
-
149
- # Defines which strategy will be used to unlock an account.
150
- # :email = Sends an unlock link to the user email
151
- # :time = Re-enables login after a certain amount of time (see :unlock_in below)
152
- # :both = Enables both strategies
153
- # :none = No unlock strategy. You should handle unlocking by yourself.
154
- # config.unlock_strategy = :both
155
-
156
- # Number of authentication tries before locking an account if lock_strategy
157
- # is failed attempts.
158
- # config.maximum_attempts = 20
159
-
160
- # Time interval to unlock the account if :time is enabled as unlock_strategy.
161
- # config.unlock_in = 1.hour
162
-
163
- # ==> Configuration for :recoverable
164
- #
165
- # Defines which key will be used when recovering the password for an account
166
- # config.reset_password_keys = [ :email ]
167
-
168
- # Time interval you can reset your password with a reset password key.
169
- # Don't put a too small interval or your users won't have the time to
170
- # change their passwords.
171
- config.reset_password_within = 6.hours
172
-
173
- # ==> Configuration for :encryptable
174
- # Allow you to use another encryption algorithm besides bcrypt (default). You can use
175
- # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
176
- # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
177
- # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
178
- # REST_AUTH_SITE_KEY to pepper)
179
- # config.encryptor = :sha512
180
-
181
- # ==> Configuration for :token_authenticatable
182
- # Defines name of the authentication token params key
183
- # config.token_authentication_key = :auth_token
184
-
185
- # ==> Scopes configuration
186
- # Turn scoped views on. Before rendering "sessions/new", it will first check for
187
- # "users/sessions/new". It's turned off by default because it's slower if you
188
- # are using only default views.
189
- # config.scoped_views = false
190
-
191
- # Configure the default scope given to Warden. By default it's the first
192
- # devise role declared in your routes (usually :user).
193
- # config.default_scope = :user
194
-
195
- # Configure sign_out behavior.
196
- # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
197
- # The default is true, which means any logout action will sign out all active scopes.
198
- # config.sign_out_all_scopes = true
199
-
200
- # ==> Navigation configuration
201
- # Lists the formats that should be treated as navigational. Formats like
202
- # :html, should redirect to the sign in page when the user does not have
203
- # access, but formats like :xml or :json, should return 401.
204
- #
205
- # If you have any extra navigational formats, like :iphone or :mobile, you
206
- # should add them to the navigational formats lists.
207
- #
208
- # The "*/*" below is required to match Internet Explorer requests.
209
- # config.navigational_formats = ["*/*", :html]
210
-
211
- # The default HTTP method used to sign out a resource. Default is :delete.
212
- config.sign_out_via = :delete
213
-
214
- # ==> OmniAuth
215
- # Add a new OmniAuth provider. Check the wiki for more information on setting
216
- # up on your models and hooks.
217
- # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo'
218
-
219
- # ==> Warden configuration
220
- # If you want to use other strategies, that are not supported by Devise, or
221
- # change the failure app, you can configure them inside the config.warden block.
222
- #
223
- # config.warden do |manager|
224
- # manager.intercept_401 = false
225
- # manager.default_strategies(:scope => :user).unshift :some_external_strategy
226
- # end
227
- end
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Configure sensitive parameters which will be filtered from the log file.
4
- Rails.application.config.filter_parameters += [:password]
@@ -1,16 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format. Inflections
4
- # are locale specific, and you may define rules for as many different
5
- # locales as you wish. All of these examples are active by default:
6
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
- # inflect.plural /^(ox)$/i, '\1en'
8
- # inflect.singular /^(ox)en/i, '\1'
9
- # inflect.irregular 'person', 'people'
10
- # inflect.uncountable %w( fish sheep )
11
- # end
12
-
13
- # These inflection rules are supported but not enabled by default:
14
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
- # inflect.acronym 'RESTful'
16
- # end
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,12 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key is used for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
-
6
- # Make sure the secret is at least 30 characters and all random,
7
- # no regular words or you'll be exposed to dictionary attacks.
8
- # You can use `rake secret` to generate a secure secret key.
9
-
10
- # Make sure your secret_key_base is kept private
11
- # if you're sharing your code publicly.
12
- Rails.application.config.secret_key_base = '2c8a4e21c8caf3b6bac299ada85d1975c83931ab44c0b38c95b327b39da0d779a2f9c363ccf3af5786a0af34dcd13945c9e8be7c10be9e8dddbbf41c1a5b39c7'
@@ -1,3 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Rails.application.config.session_store :cookie_store, key: '_rails_app_session'
@@ -1,6 +0,0 @@
1
- # TheRole.config.param_name => value
2
-
3
- TheRole.configure do |config|
4
- config.layout = :application # default Layout for TheRole UI
5
- config.default_user_role = nil # set default role (name)
6
- end
@@ -1,14 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # This file contains settings for ActionController::ParamsWrapper which
4
- # is enabled by default.
5
-
6
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
- ActiveSupport.on_load(:action_controller) do
8
- wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
9
- end
10
-
11
- # To enable root element in JSON for ActiveRecord objects.
12
- # ActiveSupport.on_load(:active_record) do
13
- # self.include_root_in_json = true
14
- # end
@@ -1,57 +0,0 @@
1
- # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
-
3
- en:
4
- errors:
5
- messages:
6
- expired: "has expired, please request a new one"
7
- not_found: "not found"
8
- already_confirmed: "was already confirmed, please try signing in"
9
- not_locked: "was not locked"
10
- not_saved:
11
- one: "1 error prohibited this %{resource} from being saved:"
12
- other: "%{count} errors prohibited this %{resource} from being saved:"
13
-
14
- devise:
15
- failure:
16
- already_authenticated: 'You are already signed in.'
17
- unauthenticated: 'You need to sign in or sign up before continuing.'
18
- unconfirmed: 'You have to confirm your account before continuing.'
19
- locked: 'Your account is locked.'
20
- invalid: 'Invalid email or password.'
21
- invalid_token: 'Invalid authentication token.'
22
- timeout: 'Your session expired, please sign in again to continue.'
23
- inactive: 'Your account was not activated yet.'
24
- sessions:
25
- signed_in: 'Signed in successfully.'
26
- signed_out: 'Signed out successfully.'
27
- passwords:
28
- send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
29
- updated: 'Your password was changed successfully. You are now signed in.'
30
- updated_not_active: 'Your password was changed successfully.'
31
- send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
32
- confirmations:
33
- send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
34
- send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
35
- confirmed: 'Your account was successfully confirmed. You are now signed in.'
36
- registrations:
37
- signed_up: 'Welcome! You have signed up successfully.'
38
- signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.'
39
- signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.'
40
- signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.'
41
- updated: 'You updated your account successfully.'
42
- update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
43
- destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
44
- unlocks:
45
- send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
46
- unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
47
- send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
48
- omniauth_callbacks:
49
- success: 'Successfully authorized from %{kind} account.'
50
- failure: 'Could not authorize you from %{kind} because "%{reason}".'
51
- mailer:
52
- confirmation_instructions:
53
- subject: 'Confirmation instructions'
54
- reset_password_instructions:
55
- subject: 'Reset password instructions'
56
- unlock_instructions:
57
- subject: 'Unlock Instructions'
@@ -1,7 +0,0 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See https://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- layouts:
6
- application:
7
- current_locale: 'Current locale: '
@@ -1,4 +0,0 @@
1
- ru:
2
- layouts:
3
- application:
4
- current_locale: 'Текущая локаль: '
@@ -1,26 +0,0 @@
1
- RailsApp::Application.routes.draw do
2
- devise_for :users
3
-
4
- concern :the_role, TheRole::AdminRoutes.new
5
-
6
- namespace :admin do
7
- concerns :the_role
8
- end
9
-
10
- root :to => 'welcome#index'
11
-
12
- get 'welcome/index'
13
- get 'welcome/profile'
14
- get 'autologin' => 'welcome#autologin', :as => :autologin
15
-
16
- put 'users/change_role' => "users#change_role", :as => :change_role
17
-
18
- resources :users, :only => [:edit, :update]
19
-
20
- resources :pages do
21
- collection do
22
- get :my
23
- get :manage
24
- end
25
- end
26
- end
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Rails.application
@@ -1,63 +0,0 @@
1
- class DeviseCreateUsers < ActiveRecord::Migration
2
- def change
3
- create_table(:users) do |t|
4
- ## Custom fields
5
- t.string :name
6
- t.string :company
7
- t.string :address
8
-
9
- # special field for Mass assignment test
10
- t.string :some_protected_field, :default => "should_not_be_changed"
11
-
12
- ## Database authenticatable
13
- t.string :email, :null => false, :default => ""
14
- t.string :encrypted_password, :null => false, :default => ""
15
-
16
- # Unsecure password
17
- t.string :password, :null => false, :default => ""
18
-
19
- ## Recoverable
20
- t.string :reset_password_token
21
- t.datetime :reset_password_sent_at
22
-
23
- # TheRole FIELD
24
- t.integer :role_id
25
-
26
- ## Rememberable
27
- t.datetime :remember_created_at
28
-
29
- ## Trackable
30
- t.integer :sign_in_count, :default => 0
31
- t.datetime :current_sign_in_at
32
- t.datetime :last_sign_in_at
33
- t.string :current_sign_in_ip
34
- t.string :last_sign_in_ip
35
-
36
- ## Encryptable
37
- # t.string :password_salt
38
-
39
- ## Confirmable
40
- # t.string :confirmation_token
41
- # t.datetime :confirmed_at
42
- # t.datetime :confirmation_sent_at
43
- # t.string :unconfirmed_email # Only if using reconfirmable
44
-
45
- ## Lockable
46
- # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
47
- # t.string :unlock_token # Only if unlock strategy is :email or :both
48
- # t.datetime :locked_at
49
-
50
- ## Token authenticatable
51
- # t.string :authentication_token
52
-
53
-
54
- t.timestamps
55
- end
56
-
57
- add_index :users, :email, :unique => true
58
- add_index :users, :reset_password_token, :unique => true
59
- # add_index :users, :confirmation_token, :unique => true
60
- # add_index :users, :unlock_token, :unique => true
61
- # add_index :users, :authentication_token, :unique => true
62
- end
63
- end
@@ -1,18 +0,0 @@
1
- class CreateRoles < ActiveRecord::Migration
2
- def self.up
3
- create_table :roles do |t|
4
-
5
- t.string :name
6
- t.string :title
7
- t.text :description
8
-
9
- t.text :the_role
10
-
11
- t.timestamps
12
- end
13
- end
14
-
15
- def self.down
16
- drop_table :roles
17
- end
18
- end
@@ -1,14 +0,0 @@
1
- class CreatePages < ActiveRecord::Migration
2
- def change
3
- create_table :pages do |t|
4
- t.integer :user_id
5
- t.integer :person_id
6
-
7
- t.string :title
8
- t.text :content
9
- t.string :state, default: :draft
10
-
11
- t.timestamps
12
- end
13
- end
14
- end
@@ -1,59 +0,0 @@
1
- # encoding: UTF-8
2
- # This file is auto-generated from the current state of the database. Instead
3
- # of editing this file, please use the migrations feature of Active Record to
4
- # incrementally modify your database, and then regenerate this schema definition.
5
- #
6
- # Note that this schema.rb definition is the authoritative source for your
7
- # database schema. If you need to create the application database on another
8
- # system, you should be using db:schema:load, not running all the migrations
9
- # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
- # you'll amass, the slower it'll run and the greater likelihood for issues).
11
- #
12
- # It's strongly recommended that you check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(version: 20120314061307) do
15
-
16
- create_table "pages", force: true do |t|
17
- t.integer "user_id"
18
- t.integer "person_id"
19
- t.string "title"
20
- t.text "content"
21
- t.string "state", default: "draft"
22
- t.datetime "created_at"
23
- t.datetime "updated_at"
24
- end
25
-
26
- create_table "roles", force: true do |t|
27
- t.string "name"
28
- t.string "title"
29
- t.text "description"
30
- t.text "the_role"
31
- t.datetime "created_at"
32
- t.datetime "updated_at"
33
- end
34
-
35
- create_table "users", force: true do |t|
36
- t.string "name"
37
- t.string "company"
38
- t.string "address"
39
- t.string "some_protected_field", default: "should_not_be_changed"
40
- t.string "email", default: "", null: false
41
- t.string "encrypted_password", default: "", null: false
42
- t.string "password", default: "", null: false
43
- t.string "reset_password_token"
44
- t.datetime "reset_password_sent_at"
45
- t.integer "role_id"
46
- t.datetime "remember_created_at"
47
- t.integer "sign_in_count", default: 0
48
- t.datetime "current_sign_in_at"
49
- t.datetime "last_sign_in_at"
50
- t.string "current_sign_in_ip"
51
- t.string "last_sign_in_ip"
52
- t.datetime "created_at"
53
- t.datetime "updated_at"
54
- end
55
-
56
- add_index "users", ["email"], name: "index_users_on_email", unique: true
57
- add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
58
-
59
- end
@@ -1,85 +0,0 @@
1
- ##############################
2
- # Roles
3
- ##############################
4
- Role.create!(
5
- name: :user,
6
- title: :role_for_users,
7
- description: :user_can_edit_his_pages,
8
- the_role: {
9
- pages: {
10
- index: true,
11
- show: true,
12
- new: true,
13
- create: true,
14
- edit: true,
15
- update: true,
16
- destroy: true,
17
- my: true,
18
- secret: false
19
- }
20
- }
21
- )
22
-
23
- Role.create!(
24
- name: :pages_moderator,
25
- title: :pages_moderator,
26
- description: :can_do_anything_with_pages,
27
- the_role: { moderator: { pages: true } }
28
- )
29
-
30
- TheRole.create_admin_role!
31
-
32
- p "Roles created"
33
-
34
- ##############################
35
- # Users
36
- ##############################
37
- User.create!(
38
- email: 'admin@site.com',
39
- name: Faker::Name.name,
40
- company: Faker::Company.name,
41
- address: Faker::Address.street_address,
42
- password: 'qwerty',
43
- password_confirmation: 'qwerty',
44
- role: Role.with_name(:admin)
45
- )
46
-
47
- User.create!(
48
- email: Faker::Internet.email,
49
- name: Faker::Name.name,
50
- company: Faker::Company.name,
51
- address: Faker::Address.street_address,
52
- password: 'qwerty',
53
- password_confirmation: 'qwerty',
54
- role: Role.with_name(:pages_moderator)
55
- )
56
-
57
- 5.times do
58
- User.create!(
59
- email: Faker::Internet.email,
60
- name: Faker::Name.name,
61
- company: Faker::Company.name,
62
- address: Faker::Address.street_address,
63
- password: 'qwerty',
64
- password_confirmation: 'qwerty',
65
- role: Role.with_name(:user)
66
- )
67
- end
68
-
69
- p "Users created"
70
-
71
- ##############################
72
- # Pages
73
- ##############################
74
-
75
- User.all.each do |user|
76
- 10.times do
77
- user.pages.create!(
78
- title: Faker::Lorem.sentence,
79
- content: Faker::Lorem.paragraphs(3).join,
80
- state: %w[draft published].sample
81
- )
82
- end
83
- end
84
-
85
- p "Pages created"
File without changes
File without changes
@@ -1,15 +0,0 @@
1
- namespace :assets do
2
- # rake assets:drop
3
- desc "Drop assets"
4
- task drop: :environment do
5
- Rake::Task["assets:clean"].invoke
6
- Rake::Task["assets:clobber"].invoke
7
- end
8
-
9
- # rake assets:build
10
- desc "Precompile assets"
11
- task build: :environment do
12
- Rake::Task["assets:drop"].invoke
13
- Rake::Task["assets:precompile"].invoke
14
- end
15
- end