wcc-auth 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -3
- data/lib/wcc/auth/devise/watermark_callbacks_controller.rb +2 -4
- data/lib/wcc/auth/version.rb +1 -1
- metadata +25 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3c7e9259c716d32bb56f4e6b7da678bdc9d158b
|
4
|
+
data.tar.gz: 60b330ef71e4327cfbc992148dff79474baf3624
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 328b4bf8ef14bd065f3d0fab25c394229387d87718ddb86b97bf18e4d234818df02177aa2a578ea42c82c2666c31f176d233854e6e4b735083640a9188e0cde0
|
7
|
+
data.tar.gz: 5621686cb846090c6295f1367091d04e8f31726740e12febb3110b23d704ebff64ef43557773c15b989ea01c9f070a8b476ed61cb8edbc5abcbb579b9762b769
|
data/README.md
CHANGED
@@ -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[
|
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
|
-
|
data/lib/wcc/auth/version.rb
CHANGED
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.
|
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:
|
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
|
184
|
-
authorization (optional) If you would like to use the
|
185
|
-
with `WCC::Auth` just create an Ability class that
|
186
|
-
class. The authenticated user will include
|
187
|
-
This corresponds to a `WCC::Auth::AccessLevel`. The
|
188
|
-
into 5 tiers with the following rules: * **No access**
|
189
|
-
* **Basic** -- This is provides read-only access *
|
190
|
-
for only data the user owns * **Manage** -- Read-write
|
191
|
-
Admin** -- Can change app configuration * **System Admin**
|
192
|
-
all features always Each tier inherits all priveleges of
|
193
|
-
here are guidelines for the app to follow. It is ultimately
|
194
|
-
to decide what each of these tiers means for it. Do
|
195
|
-
rules. Here is an example Ability class using the
|
196
|
-
class Ability < WCC::Auth::TieredAbility at_level(:contribute)
|
197
|
-
Person can :manage, Task, created_by_id: user.id can :manage,
|
198
|
-
user.id cannot :destroy, Task end at_level(:appadmin)
|
199
|
-
cannot :create, TaskGroup end at_level(:sysadmin)
|
200
|
-
end end ``` ## Notes #### Sign out links If your
|
201
|
-
you''ll need to disable it for the sign out link(s).
|
202
|
-
app to enter an infinite redirect loop. ## Contributing 1.
|
203
|
-
feature branch (`git checkout -b my-new-feature`) 3. Commit
|
204
|
-
-am ''Add some feature''`) 4. Push to the branch (`git
|
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
|