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 +4 -4
- data/LICENSE +1 -1
- data/README.md +12 -2
- data/app/models/wobauth/user.rb +2 -1
- data/app/views/wobauth/users/index.html.erb +1 -1
- data/app/views/wobauth/users/show.html.erb +1 -1
- data/config/ldap.yml.example +9 -0
- data/config/locales/wobapphelpers.de.yml +11 -7
- data/config/locales/wobapphelpers.en.yml +9 -3
- data/lib/wobauth/concerns/models/user_concerns.rb +40 -0
- data/lib/wobauth/version.rb +2 -2
- metadata +6 -5
- data/lib/concerns/models/user.rb +0 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a1e15fe42e6ce8fcc8274e264e6b6ff4411b465b78203a2afe1dc9050c934e3
|
4
|
+
data.tar.gz: fc1141b984c94361f6d697b022b68de04ec794caea6f337218f2dc4be65c9315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d3c9edcd37cb311eb8586c73797157b40b6904d88f31e503bddad4b33e4eb2d715a8b1e8476f82ecfa0851afe2d26eda54ffa5c7aa7586c4bf9e7baf77f733f
|
7
|
+
data.tar.gz: bdfd6aa3a3cf02f59b4ddc6c890bf4b76bb9e5a4463ce522dc2f14c58c9cbeb578c33eafc45c50baaade0ea2f3f983ea81c62faf82850534208f75a15ce7df41
|
data/LICENSE
CHANGED
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
|
-
|
|
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-
|
184
|
+
wobauth Copyright (C) 2014-2020 Wolfgang Barth
|
175
185
|
|
176
186
|
MIT license, see [LICENSE](LICENSE)
|
177
187
|
|
data/app/models/wobauth/user.rb
CHANGED
@@ -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
|
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
|
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
|
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>
|
@@ -1,10 +1,14 @@
|
|
1
1
|
de:
|
2
2
|
wobapphelpers:
|
3
3
|
helpers:
|
4
|
-
back:
|
5
|
-
cancel:
|
6
|
-
|
7
|
-
new: "%{
|
8
|
-
create: "%{
|
9
|
-
|
10
|
-
|
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
|
-
|
7
|
-
new: "create %{
|
8
|
-
|
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
|
data/lib/wobauth/version.rb
CHANGED
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
|
+
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:
|
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
|
data/lib/concerns/models/user.rb
DELETED
@@ -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
|