wcc-auth 0.6.0 → 0.7.0

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: fb6bf890e98d60f40cdebab2cb97ba9ef70e7101
4
- data.tar.gz: 9bb463bc83d2741b9059a04ce466e6e668827485
3
+ metadata.gz: 18b674d08200f15499cccd1b8d1fd99916d7c744
4
+ data.tar.gz: 18eda6bc05124affbc80279597935104589edb41
5
5
  SHA512:
6
- metadata.gz: 2d7c384ce1f02d9c9c29bda115c97533441390e33fd3f1816b50ec13d39005fc1ca2e5412891a290d4d45d3a9415ed2b3bdf46f10731bf0eb28119114c240eee
7
- data.tar.gz: b4d12bc4ea9ba9e607027f79af898ef2185c7144f67061185a963a71eb84cc02ea726092ed9d33b0164f7c0cfe25a6cf1896f172dabf9c45b49452cfd71fbf98
6
+ metadata.gz: cf2801c9dc386cffa8535ad5b91dac36362bd5e30126a36bee4259955a0ac289534156a55dd59b796333848107f831421f3cf2a6e4ebce3c18a3a9a0d2e507df
7
+ data.tar.gz: '09706c0b7f3a3a891f28b8005671436d4f5090c2fbc52890158e4f407f655e45f085193922063cd872824ccafd2941fde50bae9af8d49fc98cc565241d86d409'
data/README.md CHANGED
@@ -8,6 +8,8 @@ any Ruby project. Currently, the only tested path is Rails with Devise.
8
8
 
9
9
  ## Installation
10
10
 
11
+ **NOTE: `v0.6.0` has been updated for use with Rails 5.1 and requires Ruby 2.2 or greater.**
12
+
11
13
  Add this line to your application's Gemfile:
12
14
 
13
15
  ```ruby
@@ -107,6 +109,12 @@ class Ability < WCC::Auth::TieredAbility
107
109
  end
108
110
  ```
109
111
 
112
+ ## Notes
113
+
114
+ #### Sign out links
115
+
116
+ If your project is using `TurboLinks`, you'll need to disable it for the sign out link(s). Otherwise, it will cause your app to enter an infinite redirect loop.
117
+
110
118
  ## Contributing
111
119
 
112
120
  1. Fork it
@@ -19,6 +19,7 @@ class OmniAuth::Strategies::Watermark < OmniAuth::Strategies::OAuth2
19
19
  last_name: raw_info["last_name"],
20
20
  access_level_id: raw_info["access_level_id"],
21
21
  arena_id: raw_info["arena_id"],
22
+ rock_id: raw_info["rock_id"],
22
23
  applications: raw_info["applications"]
23
24
  }
24
25
  end
@@ -1,5 +1,5 @@
1
1
  module WCC
2
2
  module Auth
3
- VERSION = "0.6.0"
3
+ VERSION = '0.7.0'.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.6.0
4
+ version: 0.7.0
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-05-26 00:00:00.000000000 Z
11
+ date: 2017-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cancancan
@@ -166,36 +166,40 @@ summary: '# WCC::Auth Provides the necessary tools for handling authentication
166
166
  Watermark''s OAuth provider as well as authorizing the user has access to specific
167
167
  features within the application. There are special hooks for Rails apps using Devise,
168
168
  but the primitive structures could be used on any Ruby project. Currently, the only
169
- tested path is Rails with Devise. ## Installation Add this line to your application''s
170
- Gemfile: ```ruby gem ''wcc-auth'', ''~> 0.3.2'' ``` If you are using a Rails app
171
- with Devise you can use a special require hook that will setup all the Devise specific
172
- configuration for you. ```ruby gem ''wcc-auth'', ''~> 0.3.2'', require: ''wcc/auth/devise''
173
- ``` ## Configuration There are a few steps to setup your app. These instructions
174
- are specific to a Rails app. #### Add the configuration block to an initializer In
175
- order to configure the gem you must run the `WCC::Auth.setup` block. See below for
176
- an example: ```ruby WCC::Auth.setup do |config| config.app_name = "app-name" config.environment
177
- = Rails.env config.app_id = ''app-client-id-from-oauth-provider'' config.app_secret
178
- = ''app-client-secret-from-oauth-provider'' end ``` #### Setup your controllers ```ruby
179
- # Add this include to your ApplicationController class ApplicationController < ActionController::Base
180
- include WCC::Auth::ControllerHelpers end ``` #### Setup your user model ```ruby
181
- class User < ActiveRecord::Base include WCC::Auth::Providers::ActiveRecord devise
182
- :omniauthable # ... end ``` #### Setup authorization (optional) If you would
183
- like to use the `TieredAbility` class included with `WCC::Auth` just create an Ability
184
- class that extends the `WCC::Auth::TieredAbility` class. The authenticated user
185
- will include an info variables called `access_level_id`. This corresponds to a `WCC::Auth::AccessLevel`. The
186
- access levels are broken down into 5 tiers with the following rules: * **No access**
187
- -- This is the default level * **Basic** -- This is provides read-only access *
188
- **Contribute** -- Read-write for only data the user owns * **Manage** -- Read-write
189
- for other''s data * **App Admin** -- Can change app configuration * **System Admin**
190
- -- Has full access to all features always Each tier inherits all priveleges of
191
- the lower tiers. The rules here are guidelines for the app to follow. It is ultimately
192
- up to the client application to decide what each of these tiers means for it. Do
193
- your best to adhere to these rules. Here is an example Ability class using the
194
- DSL provided by `WCC::Auth`. ```ruby class Ability < WCC::Auth::TieredAbility at_level(:contribute)
195
- do |user| can :read, Person can :manage, Task, created_by_id: user.id can :manage,
196
- Comment, created_by_id: user.id cannot :destroy, Task end at_level(:appadmin)
197
- do |user| can :manage, :all cannot :create, TaskGroup end at_level(:sysadmin)
198
- do |user| can :manage, :all end end ``` ## Contributing 1. Fork it 2. Create your
169
+ tested path is Rails with Devise. ## Installation **NOTE: `v0.6.0` has been updated
170
+ for use with Rails 5.1 and requires Ruby 2.2 or greater.** Add this line to your
171
+ application''s Gemfile: ```ruby gem ''wcc-auth'', ''~> 0.3.2'' ``` If you are
172
+ using a Rails app with Devise you can use a special require hook that will setup
173
+ all the Devise specific configuration for you. ```ruby gem ''wcc-auth'', ''~> 0.3.2'',
174
+ require: ''wcc/auth/devise'' ``` ## Configuration There are a few steps to setup
175
+ your app. These instructions are specific to a Rails app. #### Add the configuration
176
+ block to an initializer In order to configure the gem you must run the `WCC::Auth.setup`
177
+ block. See below for an example: ```ruby WCC::Auth.setup do |config| config.app_name
178
+ = "app-name" config.environment = Rails.env config.app_id = ''app-client-id-from-oauth-provider''
179
+ config.app_secret = ''app-client-secret-from-oauth-provider'' end ``` #### Setup
180
+ your controllers ```ruby # Add this include to your ApplicationController class
181
+ ApplicationController < ActionController::Base include WCC::Auth::ControllerHelpers
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
199
203
  feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit
200
204
  -am ''Add some feature''`) 4. Push to the branch (`git push origin my-new-feature`)
201
205
  5. Create new Pull Request'