anadea-identity 0.2.1 → 0.3.0
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 +2 -1
 - data/config/routes.rb +5 -4
 - data/lib/identity.rb +19 -2
 - data/lib/identity/admin/user.rb +56 -58
 - data/lib/identity/engine.rb +2 -6
 - data/lib/identity/version.rb +1 -1
 - metadata +4 -4
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: def097b4755e88a07d17eecba90fcd1c6b9d8a7c
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 84fee48d01725a0c1af1f1909d9d79902f576d40
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 1748897c4af3e599fe9d4139a99194b748746918d1bbc04eef4b16ab2c32e984a63c27cca498fa654e79272b2e394562fd398c8cf8a032e99f7a7378d8220f76
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 4552d1ed458b5bfcedeeb8bb040243fb2feb6feddb7986a1af4198056a9fcbe6f1d253b76489f24ad1bc58ee20823e47b043167723a0d27536d66c952864faa1
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -78,7 +78,8 @@ email/пароль/подтверждение пароля), восстанов 
     | 
|
| 
       78 
78 
     | 
    
         
             
              прочего. По умолчанию используется главный макет вашего приложения –
         
     | 
| 
       79 
79 
     | 
    
         
             
              `"application"`.
         
     | 
| 
       80 
80 
     | 
    
         | 
| 
       81 
     | 
    
         
            -
            * `config.auth_routes` –  
     | 
| 
      
 81 
     | 
    
         
            +
            * `config.auth_routes` – позволяет передать опции для роутов Devise, подключаемых
         
     | 
| 
      
 82 
     | 
    
         
            +
              приложением. Если указать `false`, маршруты подключены не будут и вы
         
     | 
| 
       82 
83 
     | 
    
         
             
              можете сами подключить их.
         
     | 
| 
       83 
84 
     | 
    
         | 
| 
       84 
85 
     | 
    
         
             
            Вы также можете использовать любые конфигурационные опции самого Devise.
         
     | 
    
        data/config/routes.rb
    CHANGED
    
    | 
         @@ -1,8 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Rails.application.routes.draw do
         
     | 
| 
       2 
2 
     | 
    
         
             
              if Identity.auth_routes
         
     | 
| 
       3 
     | 
    
         
            -
                devise_for :users,
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
                devise_for :users, Identity.auth_routes.reverse_merge(
         
     | 
| 
      
 4 
     | 
    
         
            +
                  class_name: Identity.user_class_name,
         
     | 
| 
      
 5 
     | 
    
         
            +
                  module: :devise,
         
     | 
| 
      
 6 
     | 
    
         
            +
                  controllers: { omniauth_callbacks: "identity/omniauth_callbacks" }
         
     | 
| 
      
 7 
     | 
    
         
            +
                )
         
     | 
| 
       7 
8 
     | 
    
         
             
              end
         
     | 
| 
       8 
9 
     | 
    
         
             
            end
         
     | 
    
        data/lib/identity.rb
    CHANGED
    
    | 
         @@ -14,14 +14,31 @@ module Identity 
     | 
|
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              mattr_accessor(:user_class_name) { "::User" }
         
     | 
| 
       16 
16 
     | 
    
         
             
              mattr_accessor(:layout) { 'application' }
         
     | 
| 
       17 
     | 
    
         
            -
              mattr_accessor(:auth_routes) {  
     | 
| 
      
 17 
     | 
    
         
            +
              mattr_accessor(:auth_routes) { {} }
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              def self.user_class
         
     | 
| 
       20 
20 
     | 
    
         
             
                user_class_name.constantize
         
     | 
| 
       21 
21 
     | 
    
         
             
              end
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       23 
24 
     | 
    
         
             
              def self.setup
         
     | 
| 
       24 
25 
     | 
    
         
             
                yield self
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                unless Identity.user_class.is_a? Identity::Mixins::User
         
     | 
| 
      
 28 
     | 
    
         
            +
                  Identity.user_class.include(Identity::Mixins::User)
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                ActiveRecord::Base.class_eval do
         
     | 
| 
      
 32 
     | 
    
         
            +
                  class << self
         
     | 
| 
      
 33 
     | 
    
         
            +
                    def inherited_with_identity_model(child)
         
     | 
| 
      
 34 
     | 
    
         
            +
                      if child.name == Identity.user_class_name
         
     | 
| 
      
 35 
     | 
    
         
            +
                        child.include(Identity::Mixins::User)
         
     | 
| 
      
 36 
     | 
    
         
            +
                      end
         
     | 
| 
      
 37 
     | 
    
         
            +
                      inherited_without_identity_model(child)
         
     | 
| 
      
 38 
     | 
    
         
            +
                    end
         
     | 
| 
      
 39 
     | 
    
         
            +
                    alias_method_chain :inherited, :identity_model
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
                end
         
     | 
| 
       25 
42 
     | 
    
         
             
              end
         
     | 
| 
       26 
43 
     | 
    
         | 
| 
       27 
44 
     | 
    
         
             
              def self.method_missing(name, *args, &block)
         
     | 
| 
         @@ -33,7 +50,7 @@ module Identity 
     | 
|
| 
       33 
50 
     | 
    
         
             
              end
         
     | 
| 
       34 
51 
     | 
    
         | 
| 
       35 
52 
     | 
    
         
             
              def self.delegate_to_devise?(name)
         
     | 
| 
       36 
     | 
    
         
            -
                name.in? 
     | 
| 
      
 53 
     | 
    
         
            +
                name.in?(%w(omniauth)) ||
         
     | 
| 
       37 
54 
     | 
    
         
             
                name.ends_with?('=') && Devise.respond_to?(name)
         
     | 
| 
       38 
55 
     | 
    
         
             
              end
         
     | 
| 
       39 
56 
     | 
    
         | 
    
        data/lib/identity/admin/user.rb
    CHANGED
    
    | 
         @@ -1,74 +1,72 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
               
     | 
| 
       3 
     | 
    
         
            -
                permit_params :email, :password, :password_confirmation
         
     | 
| 
      
 1 
     | 
    
         
            +
            ActiveAdmin.register Identity.user_class, as: "Users" do
         
     | 
| 
      
 2 
     | 
    
         
            +
              permit_params :email, :password, :password_confirmation
         
     | 
| 
       4 
3 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
              filter :email
         
     | 
| 
      
 5 
     | 
    
         
            +
              filter :active
         
     | 
| 
      
 6 
     | 
    
         
            +
              filter :current_sign_in_at
         
     | 
| 
      
 7 
     | 
    
         
            +
              filter :created_at
         
     | 
| 
       9 
8 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
              scope :all
         
     | 
| 
      
 10 
     | 
    
         
            +
              scope :active, default: true
         
     | 
| 
       12 
11 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
                    end
         
     | 
| 
       22 
     | 
    
         
            -
                  end
         
     | 
| 
       23 
     | 
    
         
            -
                  if Devise.mappings[:user].trackable?
         
     | 
| 
       24 
     | 
    
         
            -
                    column :current_sign_in_ip
         
     | 
| 
       25 
     | 
    
         
            -
                    column :current_sign_in_at
         
     | 
| 
      
 12 
     | 
    
         
            +
              index do
         
     | 
| 
      
 13 
     | 
    
         
            +
                selectable_column
         
     | 
| 
      
 14 
     | 
    
         
            +
                id_column
         
     | 
| 
      
 15 
     | 
    
         
            +
                column :active
         
     | 
| 
      
 16 
     | 
    
         
            +
                column :email
         
     | 
| 
      
 17 
     | 
    
         
            +
                if Devise.mappings[:user].confirmable?
         
     | 
| 
      
 18 
     | 
    
         
            +
                  column :confirmed do |user|
         
     | 
| 
      
 19 
     | 
    
         
            +
                    status_tag user.confirmed_at ? 'yes' : 'no'
         
     | 
| 
       26 
20 
     | 
    
         
             
                  end
         
     | 
| 
       27 
     | 
    
         
            -
                  column :created_at
         
     | 
| 
       28 
     | 
    
         
            -
                  column :updated_at
         
     | 
| 
       29 
     | 
    
         
            -
                  actions
         
     | 
| 
       30 
21 
     | 
    
         
             
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
                if Devise.mappings[:user].trackable?
         
     | 
| 
      
 23 
     | 
    
         
            +
                  column :current_sign_in_ip
         
     | 
| 
      
 24 
     | 
    
         
            +
                  column :current_sign_in_at
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
                column :created_at
         
     | 
| 
      
 27 
     | 
    
         
            +
                column :updated_at
         
     | 
| 
      
 28 
     | 
    
         
            +
                actions
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
       31 
30 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
             
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
             
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                    if Devise.mappings[:user].confirmable?
         
     | 
| 
       47 
     | 
    
         
            -
                      row :confirmed_at
         
     | 
| 
       48 
     | 
    
         
            -
                    end
         
     | 
| 
      
 31 
     | 
    
         
            +
              show do
         
     | 
| 
      
 32 
     | 
    
         
            +
                attributes_table do
         
     | 
| 
      
 33 
     | 
    
         
            +
                  row :active do |user|
         
     | 
| 
      
 34 
     | 
    
         
            +
                    status_tag user.active? ? 'yes' : 'no'
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
                  row :email
         
     | 
| 
      
 37 
     | 
    
         
            +
                  if Devise.mappings[:user].trackable?
         
     | 
| 
      
 38 
     | 
    
         
            +
                    row :sign_in_count
         
     | 
| 
      
 39 
     | 
    
         
            +
                    row :current_sign_in_ip
         
     | 
| 
      
 40 
     | 
    
         
            +
                    row :current_sign_in_at
         
     | 
| 
      
 41 
     | 
    
         
            +
                    row :last_sign_in_ip
         
     | 
| 
      
 42 
     | 
    
         
            +
                    row :last_sign_in_at
         
     | 
| 
      
 43 
     | 
    
         
            +
                  end
         
     | 
| 
       49 
44 
     | 
    
         | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                    row : 
     | 
| 
      
 45 
     | 
    
         
            +
                  if Devise.mappings[:user].confirmable?
         
     | 
| 
      
 46 
     | 
    
         
            +
                    row :confirmed_at
         
     | 
| 
       52 
47 
     | 
    
         
             
                  end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  row :created_at
         
     | 
| 
      
 50 
     | 
    
         
            +
                  row :updated_at
         
     | 
| 
       53 
51 
     | 
    
         
             
                end
         
     | 
| 
      
 52 
     | 
    
         
            +
              end
         
     | 
| 
       54 
53 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
             
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
                  end
         
     | 
| 
       61 
     | 
    
         
            -
                  f.actions
         
     | 
| 
      
 54 
     | 
    
         
            +
              form do |f|
         
     | 
| 
      
 55 
     | 
    
         
            +
                inputs 'Basic' do
         
     | 
| 
      
 56 
     | 
    
         
            +
                  input :email
         
     | 
| 
      
 57 
     | 
    
         
            +
                  input :password
         
     | 
| 
      
 58 
     | 
    
         
            +
                  input :password_confirmation
         
     | 
| 
       62 
59 
     | 
    
         
             
                end
         
     | 
| 
      
 60 
     | 
    
         
            +
                f.actions
         
     | 
| 
      
 61 
     | 
    
         
            +
              end
         
     | 
| 
       63 
62 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                    end
         
     | 
| 
       70 
     | 
    
         
            -
                    super
         
     | 
| 
      
 63 
     | 
    
         
            +
              controller do
         
     | 
| 
      
 64 
     | 
    
         
            +
                def update
         
     | 
| 
      
 65 
     | 
    
         
            +
                  if params[:identity_user][:password].blank? && params[:identity_user][:password_confirmation].blank?
         
     | 
| 
      
 66 
     | 
    
         
            +
                    params[:identity_user].delete("password")
         
     | 
| 
      
 67 
     | 
    
         
            +
                    params[:identity_user].delete("password_confirmation")
         
     | 
| 
       71 
68 
     | 
    
         
             
                  end
         
     | 
| 
      
 69 
     | 
    
         
            +
                  super
         
     | 
| 
       72 
70 
     | 
    
         
             
                end
         
     | 
| 
       73 
71 
     | 
    
         
             
              end
         
     | 
| 
       74 
72 
     | 
    
         
             
            end
         
     | 
    
        data/lib/identity/engine.rb
    CHANGED
    
    | 
         @@ -10,12 +10,8 @@ module Identity 
     | 
|
| 
       10 
10 
     | 
    
         
             
                end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                initializer "identity-admin" do |app|
         
     | 
| 
       13 
     | 
    
         
            -
                  ActiveAdmin 
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                initializer "identity-model" do
         
     | 
| 
       17 
     | 
    
         
            -
                  unless Identity.user_class.is_a?(Identity::Mixins::User)
         
     | 
| 
       18 
     | 
    
         
            -
                    Identity.user_class.include(Identity::Mixins::User)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  if defined?(ActiveAdmin)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    ActiveAdmin.application.load_paths.unshift(File.dirname(__FILE__) + "/admin")
         
     | 
| 
       19 
15 
     | 
    
         
             
                  end
         
     | 
| 
       20 
16 
     | 
    
         
             
                end
         
     | 
| 
       21 
17 
     | 
    
         
             
              end
         
     | 
    
        data/lib/identity/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: anadea-identity
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Anadea team
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2015-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-04-28 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rails
         
     | 
| 
         @@ -16,7 +16,7 @@ dependencies: 
     | 
|
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
17 
     | 
    
         
             
                - - ">="
         
     | 
| 
       18 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version:  
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 3.2.6
         
     | 
| 
       20 
20 
     | 
    
         
             
                - - "<"
         
     | 
| 
       21 
21 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       22 
22 
     | 
    
         
             
                    version: '5'
         
     | 
| 
         @@ -26,7 +26,7 @@ dependencies: 
     | 
|
| 
       26 
26 
     | 
    
         
             
                requirements:
         
     | 
| 
       27 
27 
     | 
    
         
             
                - - ">="
         
     | 
| 
       28 
28 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       29 
     | 
    
         
            -
                    version:  
     | 
| 
      
 29 
     | 
    
         
            +
                    version: 3.2.6
         
     | 
| 
       30 
30 
     | 
    
         
             
                - - "<"
         
     | 
| 
       31 
31 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       32 
32 
     | 
    
         
             
                    version: '5'
         
     |