wcc-auth 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 18b674d08200f15499cccd1b8d1fd99916d7c744
4
- data.tar.gz: 18eda6bc05124affbc80279597935104589edb41
3
+ metadata.gz: d3c7e9259c716d32bb56f4e6b7da678bdc9d158b
4
+ data.tar.gz: 60b330ef71e4327cfbc992148dff79474baf3624
5
5
  SHA512:
6
- metadata.gz: cf2801c9dc386cffa8535ad5b91dac36362bd5e30126a36bee4259955a0ac289534156a55dd59b796333848107f831421f3cf2a6e4ebce3c18a3a9a0d2e507df
7
- data.tar.gz: '09706c0b7f3a3a891f28b8005671436d4f5090c2fbc52890158e4f407f655e45f085193922063cd872824ccafd2941fde50bae9af8d49fc98cc565241d86d409'
6
+ metadata.gz: 328b4bf8ef14bd065f3d0fab25c394229387d87718ddb86b97bf18e4d234818df02177aa2a578ea42c82c2666c31f176d233854e6e4b735083640a9188e0cde0
7
+ data.tar.gz: 5621686cb846090c6295f1367091d04e8f31726740e12febb3110b23d704ebff64ef43557773c15b989ea01c9f070a8b476ed61cb8edbc5abcbb579b9762b769
data/README.md CHANGED
@@ -56,10 +56,8 @@ end
56
56
  ```ruby
57
57
  class User < ActiveRecord::Base
58
58
  include WCC::Auth::Providers::ActiveRecord
59
- devise :omniauthable
60
-
59
+ devise :omniauthable, omniauth_providers: %i[watermark]
61
60
  # ...
62
-
63
61
  end
64
62
  ```
65
63
 
@@ -2,11 +2,11 @@ class WCC::Auth::Devise::WatermarkCallbacksController < Devise::OmniauthCallback
2
2
  skip_authorization_check if respond_to?(:skip_authorization_check)
3
3
 
4
4
  def watermark
5
- oauth_data = request.env["omniauth.auth"]
5
+ oauth_data = request.env['omniauth.auth']
6
6
  @user = User.initialize_from_watermark_oauth(oauth_data)
7
7
  @user.save
8
8
 
9
- sign_in_and_redirect @user
9
+ sign_in_and_redirect @user, event: :authentication
10
10
  end
11
11
 
12
12
  def failure
@@ -21,6 +21,4 @@ class WCC::Auth::Devise::WatermarkCallbacksController < Devise::OmniauthCallback
21
21
  def after_omniauth_failure_path_for(scope)
22
22
  root_path
23
23
  end
24
-
25
24
  end
26
-
@@ -1,5 +1,5 @@
1
1
  module WCC
2
2
  module Auth
3
- VERSION = '0.7.0'.freeze
3
+ VERSION = '0.7.1'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wcc-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Watermark Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-29 00:00:00.000000000 Z
11
+ date: 2018-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cancancan
@@ -180,29 +180,29 @@ summary: '# WCC::Auth Provides the necessary tools for handling authentication
180
180
  your controllers ```ruby # Add this include to your ApplicationController class
181
181
  ApplicationController < ActionController::Base include WCC::Auth::ControllerHelpers
182
182
  end ``` #### Setup your user model ```ruby class User < ActiveRecord::Base include
183
- WCC::Auth::Providers::ActiveRecord devise :omniauthable # ... end ``` #### Setup
184
- authorization (optional) If you would like to use the `TieredAbility` class included
185
- with `WCC::Auth` just create an Ability class that extends the `WCC::Auth::TieredAbility`
186
- class. The authenticated user will include an info variables called `access_level_id`.
187
- This corresponds to a `WCC::Auth::AccessLevel`. The access levels are broken down
188
- into 5 tiers with the following rules: * **No access** -- This is the default level
189
- * **Basic** -- This is provides read-only access * **Contribute** -- Read-write
190
- for only data the user owns * **Manage** -- Read-write for other''s data * **App
191
- Admin** -- Can change app configuration * **System Admin** -- Has full access to
192
- all features always Each tier inherits all priveleges of the lower tiers. The rules
193
- here are guidelines for the app to follow. It is ultimately up to the client application
194
- to decide what each of these tiers means for it. Do your best to adhere to these
195
- rules. Here is an example Ability class using the DSL provided by `WCC::Auth`. ```ruby
196
- class Ability < WCC::Auth::TieredAbility at_level(:contribute) do |user| can :read,
197
- Person can :manage, Task, created_by_id: user.id can :manage, Comment, created_by_id:
198
- user.id cannot :destroy, Task end at_level(:appadmin) do |user| can :manage, :all
199
- cannot :create, TaskGroup end at_level(:sysadmin) do |user| can :manage, :all
200
- end end ``` ## Notes #### Sign out links If your project is using `TurboLinks`,
201
- you''ll need to disable it for the sign out link(s). Otherwise, it will cause your
202
- app to enter an infinite redirect loop. ## Contributing 1. Fork it 2. Create your
203
- feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit
204
- -am ''Add some feature''`) 4. Push to the branch (`git push origin my-new-feature`)
205
- 5. Create new Pull Request'
183
+ WCC::Auth::Providers::ActiveRecord devise :omniauthable, omniauth_providers: %i[watermark]
184
+ # ... end ``` #### Setup authorization (optional) If you would like to use the
185
+ `TieredAbility` class included with `WCC::Auth` just create an Ability class that
186
+ extends the `WCC::Auth::TieredAbility` class. The authenticated user will include
187
+ an info variables called `access_level_id`. This corresponds to a `WCC::Auth::AccessLevel`. The
188
+ access levels are broken down into 5 tiers with the following rules: * **No access**
189
+ -- This is the default level * **Basic** -- This is provides read-only access *
190
+ **Contribute** -- Read-write for only data the user owns * **Manage** -- Read-write
191
+ for other''s data * **App Admin** -- Can change app configuration * **System Admin**
192
+ -- Has full access to all features always Each tier inherits all priveleges of
193
+ the lower tiers. The rules here are guidelines for the app to follow. It is ultimately
194
+ up to the client application to decide what each of these tiers means for it. Do
195
+ your best to adhere to these rules. Here is an example Ability class using the
196
+ DSL provided by `WCC::Auth`. ```ruby class Ability < WCC::Auth::TieredAbility at_level(:contribute)
197
+ do |user| can :read, Person can :manage, Task, created_by_id: user.id can :manage,
198
+ Comment, created_by_id: user.id cannot :destroy, Task end at_level(:appadmin)
199
+ do |user| can :manage, :all cannot :create, TaskGroup end at_level(:sysadmin)
200
+ do |user| can :manage, :all end end ``` ## Notes #### Sign out links If your
201
+ project is using `TurboLinks`, you''ll need to disable it for the sign out link(s).
202
+ Otherwise, it will cause your app to enter an infinite redirect loop. ## Contributing 1.
203
+ Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit
204
+ your changes (`git commit -am ''Add some feature''`) 4. Push to the branch (`git
205
+ push origin my-new-feature`) 5. Create new Pull Request'
206
206
  test_files:
207
207
  - spec/spec_helper.rb
208
208
  - spec/wcc/auth/access_level_spec.rb