wobauth 4.0.0 → 5.0.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
  SHA256:
3
- metadata.gz: 036ba4d2f604909cb8d224f27fc1570723520ddcdbe0f830e26f3f2eecdb93ae
4
- data.tar.gz: 781621423c2cccdff5f9c1477eae55cfe9517d6e21f814bfbe67f8c4b0e04d6a
3
+ metadata.gz: 4a1e15fe42e6ce8fcc8274e264e6b6ff4411b465b78203a2afe1dc9050c934e3
4
+ data.tar.gz: fc1141b984c94361f6d697b022b68de04ec794caea6f337218f2dc4be65c9315
5
5
  SHA512:
6
- metadata.gz: c2615f3b762673ab9697f2d2619d2965269f2763daa246517c0039e63e52e7309f2b71cab759e5900e843401f88eee5e71994f43d209bbfa44cacbf817640b43
7
- data.tar.gz: 0af1198085fb8ef517204d41990cfb64b9d280b85b478d0ea3ca4b36b804e11075a4e3b129dbe480c4f90ebe26add903bf20ed88a10b85b6e79ccd5e17a93af2
6
+ metadata.gz: 8d3c9edcd37cb311eb8586c73797157b40b6904d88f31e503bddad4b33e4eb2d715a8b1e8476f82ecfa0851afe2d26eda54ffa5c7aa7586c4bf9e7baf77f733f
7
+ data.tar.gz: bdfd6aa3a3cf02f59b4ddc6c890bf4b76bb9e5a4463ce522dc2f14c58c9cbeb578c33eafc45c50baaade0ea2f3f983ea81c62faf82850534208f75a15ce7df41
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License (MIT)
2
2
 
3
- Copyright (c) 2014-2019 Wolfgang Barth
3
+ Copyright (c) 2014-2020 Wolfgang Barth
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -29,13 +29,22 @@ wobauth 1.x is for Rails 4, wobauth 2.x will support Rails 5.
29
29
  wobauth 3.x uses bootstrap v4 and font-awesome, starting with Rails 5.1
30
30
  (may work with Rails 5.0, but not tested)
31
31
  wobauth 4.x works with sprockets v4.
32
+ wobauth 5.x works with rails 6.x and is designed for autoloading via zeitwerk.
32
33
 
33
34
  Requirements
34
35
  ------------
35
36
 
37
+ ### Rails >= 6.0, autoload = :zeitwerk
38
+
39
+ | branch | rails | ruby | bootstrap | icons | wobapphelpers |
40
+ |------------|-------|--------|-----------|-----------------|---------------|
41
+ | master(5.x)| >=6.0 | >= 2.6 | v4 | fontawesome 5.x | master (4.x) |
42
+
43
+ ### Rails <= 5.2, autoload = :classic
44
+
36
45
  | branch | rails | ruby | bootstrap | icons | wobapphelpers |
37
46
  |------------|-------|--------|-----------|-----------------|---------------|
38
- | master(4.x)| >=5.1 | >= 2.3 | v4 | fontawesome 5.x | master (4.x) |
47
+ | 4-0-stable | >=5.1 | >= 2.3 | v4 | fontawesome 5.x | master (4.x) |
39
48
  | 3-0-stable | >=5.1 | >= 2.3 | v4 | fontawesome 4.7 | 3-0-stable |
40
49
  | 2-0-stable | 5.0 | >= 2.2 | v3 | glyphicons | 2-0-stable |
41
50
  | 1-0-stable | 4.2 | >= 2.0 | v3 | glyphicons | 1-0-stable |
@@ -48,6 +57,7 @@ Installation
48
57
  Add wobauth to your Gemfile:
49
58
 
50
59
  ```ruby
60
+ gem 'wobauth', '~> 5.0.0'
51
61
  gem 'wobauth', '~> 4.0.0'
52
62
  gem 'wobauth', '~> 3.4.8'
53
63
  gem 'wobauth', git: 'https://github.com/swobspace/wobauth.git', branch: '3-0-stable'
@@ -171,7 +181,7 @@ included in this rails engine.
171
181
  Licence
172
182
  -------
173
183
 
174
- wobauth Copyright (C) 2014-2019 Wolfgang Barth
184
+ wobauth Copyright (C) 2014-2020 Wolfgang Barth
175
185
 
176
186
  MIT license, see [LICENSE](LICENSE)
177
187
 
@@ -1,7 +1,8 @@
1
+ require_dependency 'wobauth/concerns/models/user_concerns'
1
2
  module Wobauth
2
3
  class User < ActiveRecord::Base
3
4
  # dependencies within wobauth models
4
-   include Wobauth::Concerns::Models::User
5
+   include UserConcerns
5
6
 
6
7
  # Include default devise modules. Others available are:
7
8
  # :confirmable, :lockable, :timeoutable and :omniauthable
@@ -49,4 +49,4 @@
49
49
 
50
50
  <%= back_link %>
51
51
  <%= new_link [wobauth, Wobauth::User] %>
52
- <%= link_to t('wobauth.new_user_from_ad'), wobauth.ad_users_path, class: 'btn btn-secondary' %>
52
+ <%= link_to(t('wobauth.new_user_from_ad'), wobauth.ad_users_path, class: 'btn btn-secondary') if can? :create, Wobauth::User %>
@@ -94,7 +94,7 @@
94
94
  <%= edit_link([wobauth, @user]) %>
95
95
  <%= delete_link([wobauth, @user]) %>
96
96
  <%= new_link [wobauth, Wobauth::User] %>
97
- <%= link_to t('wobauth.new_user_from_ad'), wobauth.ad_users_path, class: 'btn btn-secondary' %>
97
+ <%= link_to(t('wobauth.new_user_from_ad'), wobauth.ad_users_path, class: 'btn btn-secondary') if can? :create, Wobauth::User %>
98
98
  </div>
99
99
 
100
100
  </div>
@@ -0,0 +1,9 @@
1
+ ldap_options:
2
+ host: 1.2.3.4
3
+ port: 3268
4
+ base: dc=example,dc=com
5
+ auth:
6
+ method: :simple
7
+ username: myusername
8
+ password: mysecretpassword
9
+
@@ -1,10 +1,14 @@
1
1
  de:
2
2
  wobapphelpers:
3
3
  helpers:
4
- back: "Zurück"
5
- cancel: "Abbrechen"
6
- controller:
7
- new: "%{name} erstellen"
8
- create: "%{name} erstellen"
9
- edit: "%{name} bearbeiten"
10
- update: "%{name} bearbeiten"
4
+ back: Zurück
5
+ cancel: Abbrechen
6
+ actions:
7
+ new: "%{model} erstellen"
8
+ create: "%{model} erstellen"
9
+ show: "%{model} anzeigen"
10
+ edit: "%{model} bearbeiten"
11
+ copy: "%{model} kopieren"
12
+ update: "%{model} bearbeiten"
13
+ destroy: "%{model} löschen"
14
+ destroy_confirm: "Der Datensatz kann nicht wieder hergestellt werden!"
@@ -3,6 +3,12 @@ en:
3
3
  helpers:
4
4
  back: Back
5
5
  cancel: Cancel
6
- controller:
7
- new: "create %{name}"
8
- edit: "update %{name}"
6
+ actions:
7
+ new: "create %{model}"
8
+ create: "create %{model}"
9
+ show: "show %{model}"
10
+ edit: "update %{model}"
11
+ update: "update %{model}"
12
+ copy: "copy %{model}"
13
+ destroy: "destroy %{model}"
14
+ destroy_confirm: "record would be finally destroyed, no recovery possible!"
@@ -0,0 +1,40 @@
1
+ module UserConcerns
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ has_many :authorities, as: :authorizable, dependent: :destroy
6
+ has_many :roles, through: :authorities
7
+ has_many :memberships, dependent: :destroy
8
+ has_many :groups, -> { distinct }, through: :memberships
9
+ has_many :group_roles, through: :groups, source: :roles
10
+ has_many :group_authorities, through: :groups, source: :authorities
11
+
12
+ validates :username, presence: true, uniqueness: true
13
+ end
14
+
15
+
16
+ def to_s
17
+ if sn.blank? and givenname.blank?
18
+ "#{username}"
19
+ elsif title.blank?
20
+ "#{sn}, #{givenname} (#{username})"
21
+ else
22
+ "#{sn}, #{title} #{givenname} (#{username})"
23
+ end
24
+ end
25
+
26
+ def name
27
+ to_s
28
+ end
29
+
30
+ def is_admin?
31
+ role?(:admin)
32
+ end
33
+
34
+ def role?(role)
35
+ (self.authorities.joins(:role)
36
+ .where("wobauth_roles.name = ?", role.to_s.camelize).present?) ||
37
+ (self.group_authorities.joins(:role)
38
+ .where("wobauth_roles.name = ?", role.to_s.camelize).present?)
39
+ end
40
+ end
@@ -1,4 +1,4 @@
1
1
  module Wobauth
2
- VERSION = "4.0.0".freeze
3
- RELEASEDATE = "2019-11-28".freeze
2
+ VERSION = "5.0.0".freeze
3
+ RELEASEDATE = "2020-01-19".freeze
4
4
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wobauth
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wolfgang Barth
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-28 00:00:00.000000000 Z
11
+ date: 2020-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '5.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5.0'
27
27
  - !ruby/object:Gem::Dependency
@@ -636,6 +636,7 @@ files:
636
636
  - config/initializers/simple_form.rb
637
637
  - config/initializers/simple_form_bootstrap.rb
638
638
  - config/initializers/wobapphelpers.rb
639
+ - config/ldap.yml.example
639
640
  - config/locales/de.yml
640
641
  - config/locales/devise.de.yml
641
642
  - config/locales/devise.en.yml
@@ -650,7 +651,6 @@ files:
650
651
  - db/migrate/20140504143328_create_wobauth_authorities.rb
651
652
  - db/migrate/20140508120810_devise_create_wobauth_users.rb
652
653
  - db/migrate/20171231084355_additional_fields_to_wobauth_user.rb
653
- - lib/concerns/models/user.rb
654
654
  - lib/generators/templates/initializers/wobauth.rb
655
655
  - lib/generators/wobauth/install_generator.rb
656
656
  - lib/tasks/wobauth_tasks.rake
@@ -661,6 +661,7 @@ files:
661
661
  - lib/templates/erb/scaffold/show.html.erb
662
662
  - lib/templates/rails/scaffold_controller/controller.rb
663
663
  - lib/wobauth.rb
664
+ - lib/wobauth/concerns/models/user_concerns.rb
664
665
  - lib/wobauth/engine.rb
665
666
  - lib/wobauth/version.rb
666
667
  - spec/factories.rb
@@ -1,44 +0,0 @@
1
- module Wobauth
2
- module Concerns
3
- module Models::User
4
- extend ActiveSupport::Concern
5
-
6
- included do
7
- has_many :authorities, as: :authorizable, dependent: :destroy
8
- has_many :roles, through: :authorities
9
- has_many :memberships, dependent: :destroy
10
- has_many :groups, -> { distinct }, through: :memberships
11
- has_many :group_roles, through: :groups, source: :roles
12
- has_many :group_authorities, through: :groups, source: :authorities
13
-
14
- validates :username, presence: true, uniqueness: true
15
- end
16
-
17
-
18
- def to_s
19
- if sn.blank? and givenname.blank?
20
- "#{username}"
21
- elsif title.blank?
22
- "#{sn}, #{givenname} (#{username})"
23
- else
24
- "#{sn}, #{title} #{givenname} (#{username})"
25
- end
26
- end
27
-
28
- def name
29
- to_s
30
- end
31
-
32
- def is_admin?
33
- role?(:admin)
34
- end
35
-
36
- def role?(role)
37
- (self.authorities.joins(:role)
38
- .where("wobauth_roles.name = ?", role.to_s.camelize).present?) ||
39
- (self.group_authorities.joins(:role)
40
- .where("wobauth_roles.name = ?", role.to_s.camelize).present?)
41
- end
42
- end
43
- end
44
- end