# -*- encoding: utf-8 -*- # stub: wcc-auth 0.3.3 ruby lib Gem::Specification.new do |s| s.name = "wcc-auth".freeze s.version = "0.3.3".freeze s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Travis Petticrew".freeze] s.date = "2015-04-09" s.description = "Authentication / Authorization library for Watermark apps".freeze s.email = ["tpetticrew@watermark.org".freeze] s.files = [".gitignore".freeze, ".rspec".freeze, "Gemfile".freeze, "LICENSE.txt".freeze, "README.md".freeze, "Rakefile".freeze, "lib/omniauth/strategies/watermark.rb".freeze, "lib/wcc/auth.rb".freeze, "lib/wcc/auth/ability.rb".freeze, "lib/wcc/auth/access_level.rb".freeze, "lib/wcc/auth/config.rb".freeze, "lib/wcc/auth/controller_helpers.rb".freeze, "lib/wcc/auth/devise.rb".freeze, "lib/wcc/auth/devise/watermark_callbacks_controller.rb".freeze, "lib/wcc/auth/providers.rb".freeze, "lib/wcc/auth/providers/active_record.rb".freeze, "lib/wcc/auth/version.rb".freeze, "spec/spec_helper.rb".freeze, "spec/wcc/auth/access_level_spec.rb".freeze, "spec/wcc/auth/config_spec.rb".freeze, "spec/wcc/auth/tiered_ability_spec.rb".freeze, "spec/wcc_auth_spec.rb".freeze, "wcc-auth.gemspec".freeze] s.homepage = "https://github.com/watermarkchurch/wcc-auth".freeze s.licenses = ["MIT".freeze] s.rubygems_version = "3.5.10".freeze s.summary = "# WCC::Auth Provides the necessary tools for handling authentication through Watermark's OAuth provider as well as authorizing the user has access to specific features within the application. There are special hooks for Rails apps using Devise, but the primitive structures could be used on any Ruby project. Currently, the only tested path is Rails with Devise. ## Installation Add this line to your application's Gemfile: ```ruby gem 'wcc-auth', '~> 0.3.2' ``` If you are using a Rails app with Devise you can use a special require hook that will setup all the Devise specific configuration for you. ```ruby gem 'wcc-auth', '~> 0.3.2', require: 'wcc/auth/devise' ``` ## Configuration There are a few steps to setup your app. These instructions are specific to a Rails app. #### Add the configuration block to an initializer In order to configure the gem you must run the `WCC::Auth.setup` block. See below for an example: ```ruby WCC::Auth.setup do |config| config.app_name = \"app-name\" config.environment = Rails.env config.app_id = 'app-client-id-from-oauth-provider' config.app_secret = 'app-client-secret-from-oauth-provider' end ``` #### Setup your controllers ```ruby # Add this include to your ApplicationController class ApplicationController < ActionController::Base include WCC::Auth::ControllerHelpers end ``` #### Setup your user model ```ruby class User < ActiveRecord::Base include WCC::Auth::Providers::ActiveRecord devise :omniauthable # ... end ``` #### Setup authorization (optional) If you would like to use the `TieredAbility` class included with `WCC::Auth` just create an Ability class that extends the `WCC::Auth::TieredAbility` class. The authenticated user will include an info variables called `access_level_id`. This corresponds to a `WCC::Auth::AccessLevel`. The access levels are broken down into 5 tiers with the following rules: * **No access** -- This is the default level * **Basic** -- This is provides read-only access * **Contribute** -- Read-write for only data the user owns * **Manage** -- Read-write for other's data * **App Admin** -- Can change app configuration * **System Admin** -- Has full access to all features always Each tier inherits all priveleges of the lower tiers. The rules here are guidelines for the app to follow. It is ultimately up to the client application to decide what each of these tiers means for it. Do your best to adhere to these rules. Here is an example Ability class using the DSL provided by `WCC::Auth`. ```ruby class Ability < WCC::Auth::TieredAbility at_level(:contribute) do |user| can :read, Person can :manage, Task, created_by_id: user.id can :manage, Comment, created_by_id: user.id cannot :destroy, Task end at_level(:appadmin) do |user| can :manage, :all cannot :create, TaskGroup end at_level(:sysadmin) do |user| can :manage, :all end end ``` ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request".freeze s.test_files = ["spec/spec_helper.rb".freeze, "spec/wcc/auth/access_level_spec.rb".freeze, "spec/wcc/auth/config_spec.rb".freeze, "spec/wcc/auth/tiered_ability_spec.rb".freeze, "spec/wcc_auth_spec.rb".freeze] s.specification_version = 4 s.add_runtime_dependency(%q.freeze, ["~> 1.9.2".freeze]) s.add_runtime_dependency(%q.freeze, ["~> 3.1".freeze]) s.add_runtime_dependency(%q.freeze, ["~> 1.1".freeze]) s.add_runtime_dependency(%q.freeze, ["~> 1.0".freeze]) s.add_development_dependency(%q.freeze, ["~> 1.3".freeze]) s.add_development_dependency(%q.freeze, [">= 0".freeze]) s.add_development_dependency(%q.freeze, [">= 0".freeze]) end