hydra-role-management 1.0.2 → 1.0.3
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/.circleci/config.yml +29 -9
- data/.github_changelog_generator +2 -0
- data/.rubocop.yml +4 -3
- data/CHANGELOG.md +148 -5
- data/Gemfile +11 -4
- data/README.md +36 -26
- data/Rakefile +1 -0
- data/app/controllers/concerns/hydra/role_management/roles_behavior.rb +13 -9
- data/app/controllers/concerns/hydra/role_management/user_roles_behavior.rb +9 -7
- data/app/controllers/roles_controller.rb +1 -0
- data/app/controllers/user_roles_controller.rb +1 -0
- data/app/models/concerns/hydra/role_management/legacy_attribute_handling.rb +1 -0
- data/app/models/concerns/hydra/role_management/user_roles.rb +1 -0
- data/app/models/role.rb +3 -1
- data/config/routes.rb +2 -1
- data/hydra-role-management.gemspec +2 -0
- data/lib/generators/roles/roles_generator.rb +7 -6
- data/lib/generators/roles/templates/hydra_role_management_rails3.rb +1 -0
- data/lib/generators/roles/templates/migrations/user_roles.rb +3 -2
- data/lib/hydra-role-management.rb +2 -1
- data/lib/hydra/role_management.rb +1 -0
- data/lib/hydra/role_management/version.rb +2 -1
- data/spec/controllers/roles_controller_spec.rb +1 -0
- data/spec/controllers/user_roles_controller_spec.rb +2 -1
- data/spec/lib/user_roles_spec.rb +1 -0
- data/spec/models/role_spec.rb +1 -0
- data/spec/routing/role_management_routes_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/test_app_templates/app/models/sample.rb +1 -0
- data/spec/test_app_templates/app/models/solr_document.rb +1 -0
- data/spec/test_app_templates/config/initializers/hydra_config.rb +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a18af0a3d576ae69f57684ad43d907d83415877d25654b11da6385370242f3c8
|
|
4
|
+
data.tar.gz: 07fd2858acc275ad0b5e6fe9bdf49fbdf77ee07f74d739dc2e12a4f084d6918f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 54f3d82b070aa200abeb4b6b0feab03cc6f15b57d869c944ca99bbaf3dd569d8020e87665dd66cbe2feaab301ab1983107d93980a9cd6eec044f0d1cda3738a1
|
|
7
|
+
data.tar.gz: 0d91a4d3a19f8cd7edaf5bfb515bd2c0d26dd9128fdd83c23af4524fee2e56bc88d781760bb60a8b467cd2597487064da967acb1f87cf8ed1584b1ce346fdb87
|
data/.circleci/config.yml
CHANGED
|
@@ -42,27 +42,47 @@ jobs:
|
|
|
42
42
|
workflows:
|
|
43
43
|
ci:
|
|
44
44
|
jobs:
|
|
45
|
+
- test:
|
|
46
|
+
name: ruby2-7_rails6-0
|
|
47
|
+
ruby_version: 2.7.0
|
|
48
|
+
rails_version: 6.0.2
|
|
49
|
+
- test:
|
|
50
|
+
name: ruby2-6_rails6-0
|
|
51
|
+
ruby_version: 2.6.5
|
|
52
|
+
rails_version: 6.0.2
|
|
53
|
+
- test:
|
|
54
|
+
name: ruby2-5_rails6-0
|
|
55
|
+
ruby_version: 2.5.7
|
|
56
|
+
rails_version: 6.0.2
|
|
57
|
+
- test:
|
|
58
|
+
name: ruby2-7_rails5-2
|
|
59
|
+
ruby_version: 2.7.0
|
|
60
|
+
rails_version: 5.2.4
|
|
45
61
|
- test:
|
|
46
62
|
name: ruby2-6_rails5-2
|
|
47
|
-
ruby_version: 2.6.
|
|
48
|
-
rails_version: 5.2.
|
|
63
|
+
ruby_version: 2.6.5
|
|
64
|
+
rails_version: 5.2.4
|
|
49
65
|
- test:
|
|
50
66
|
name: ruby2-5_rails5-2
|
|
51
|
-
ruby_version: 2.5.
|
|
52
|
-
rails_version: 5.2.
|
|
67
|
+
ruby_version: 2.5.7
|
|
68
|
+
rails_version: 5.2.4
|
|
53
69
|
- test:
|
|
54
70
|
name: ruby2-4_rails5-2
|
|
55
|
-
ruby_version: 2.4.
|
|
56
|
-
rails_version: 5.2.
|
|
71
|
+
ruby_version: 2.4.9
|
|
72
|
+
rails_version: 5.2.4
|
|
73
|
+
- test:
|
|
74
|
+
name: ruby2-7_rails5-1
|
|
75
|
+
ruby_version: 2.7.0
|
|
76
|
+
rails_version: 5.1.7
|
|
57
77
|
- test:
|
|
58
78
|
name: ruby2-6_rails5-1
|
|
59
|
-
ruby_version: 2.6.
|
|
79
|
+
ruby_version: 2.6.5
|
|
60
80
|
rails_version: 5.1.7
|
|
61
81
|
- test:
|
|
62
82
|
name: ruby2-5_rails5-1
|
|
63
|
-
ruby_version: 2.5.
|
|
83
|
+
ruby_version: 2.5.7
|
|
64
84
|
rails_version: 5.1.7
|
|
65
85
|
- test:
|
|
66
86
|
name: ruby2-4_rails5-1
|
|
67
|
-
ruby_version: 2.4.
|
|
87
|
+
ruby_version: 2.4.9
|
|
68
88
|
rails_version: 5.1.7
|
data/.rubocop.yml
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
inherit_gem:
|
|
2
|
-
bixby: bixby_default.yml
|
|
3
|
-
|
|
4
1
|
AllCops:
|
|
5
2
|
TargetRubyVersion: 2.4
|
|
6
3
|
|
|
@@ -15,6 +12,7 @@ Metrics/BlockLength:
|
|
|
15
12
|
- 'spec/lib/user_roles_spec.rb'
|
|
16
13
|
- 'spec/models/role_spec.rb'
|
|
17
14
|
- 'spec/routing/role_management_routes_spec.rb'
|
|
15
|
+
- hydra-role-management.gemspec
|
|
18
16
|
|
|
19
17
|
Metrics/LineLength:
|
|
20
18
|
Exclude:
|
|
@@ -48,3 +46,6 @@ Rails/HasAndBelongsToMany:
|
|
|
48
46
|
RSpec/DescribeClass:
|
|
49
47
|
Exclude:
|
|
50
48
|
- 'spec/routing/role_management_routes_spec.rb'
|
|
49
|
+
|
|
50
|
+
Style/Documentation:
|
|
51
|
+
Enabled: false
|
data/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,151 @@
|
|
|
1
1
|
# Changelog
|
|
2
|
-
All notable changes to this project will be documented in this file.
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## [1.0.3](https://github.com/samvera/hydra-role-management/tree/1.0.3) (2020-06-10)
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
[Full Changelog](https://github.com/samvera/hydra-role-management/compare/v1.0.2...1.0.3)
|
|
6
|
+
|
|
7
|
+
**Closed issues:**
|
|
8
|
+
|
|
9
|
+
- Add support for Rails 6.0.z releases [#56](https://github.com/samvera/hydra-role-management/issues/56)
|
|
10
|
+
- Add support for Ruby 2.7.z releases [#55](https://github.com/samvera/hydra-role-management/issues/55)
|
|
11
|
+
|
|
12
|
+
**Merged pull requests:**
|
|
13
|
+
|
|
14
|
+
- Adding Ruby 2.7.z and Rails 6.y.z to the CircleCI build configuration [#58](https://github.com/samvera/hydra-role-management/pull/58) ([randalldfloyd](https://github.com/randalldfloyd))
|
|
15
|
+
|
|
16
|
+
## [v1.0.2](https://github.com/samvera/hydra-role-management/tree/v1.0.2) (2019-09-24)
|
|
17
|
+
|
|
18
|
+
[Full Changelog](https://github.com/samvera/hydra-role-management/compare/v1.0.1...v1.0.2)
|
|
19
|
+
|
|
20
|
+
**Implemented enhancements:**
|
|
21
|
+
|
|
22
|
+
- Generate a changelog [#49](https://github.com/samvera/hydra-role-management/issues/49)
|
|
23
|
+
|
|
24
|
+
**Closed issues:**
|
|
25
|
+
|
|
26
|
+
- Json 1.8 dependency is incompatible with bundler 2.x [#53](https://github.com/samvera/hydra-role-management/issues/53)
|
|
27
|
+
|
|
28
|
+
**Merged pull requests:**
|
|
29
|
+
|
|
30
|
+
- Prep for 1.0.2 release [#54](https://github.com/samvera/hydra-role-management/pull/54) ([bess](https://github.com/bess))
|
|
31
|
+
- Allow for later json versions [#52](https://github.com/samvera/hydra-role-management/pull/52) ([bess](https://github.com/bess))
|
|
32
|
+
|
|
33
|
+
## [v1.0.1](https://github.com/samvera/hydra-role-management/tree/v1.0.1) (2019-09-13)
|
|
34
|
+
|
|
35
|
+
[Full Changelog](https://github.com/samvera/hydra-role-management/compare/v1.0.0...v1.0.1)
|
|
36
|
+
|
|
37
|
+
**Implemented enhancements:**
|
|
38
|
+
|
|
39
|
+
- Migrate from Waffle.io to GitHub Projects [#46](https://github.com/samvera/hydra-role-management/issues/46)
|
|
40
|
+
|
|
41
|
+
**Closed issues:**
|
|
42
|
+
|
|
43
|
+
- Test against Rails release 5.1.7 and Ruby releases 2.6.3, 2.5.5, and 2.4.6 [#47](https://github.com/samvera/hydra-role-management/issues/47)
|
|
44
|
+
- Use CircleCI for continuous integration [#44](https://github.com/samvera/hydra-role-management/issues/44)
|
|
45
|
+
- Link to the contributing guidelines in the README [#39](https://github.com/samvera/hydra-role-management/issues/39)
|
|
46
|
+
- Test using Ruby releases 2.5.1 and 2.4.4 (also, test using Rails 5.2.0, 5.1.6, and 5.0.7) [#38](https://github.com/samvera/hydra-role-management/issues/38)
|
|
47
|
+
- Replace "Hydra" with "Samvera" in CONTRIBUTING.md [#37](https://github.com/samvera/hydra-role-management/issues/37)
|
|
48
|
+
- Improve test coverage to 100% [#36](https://github.com/samvera/hydra-role-management/issues/36)
|
|
49
|
+
- Integrate RuboCop for enforcing styling guidelines [#34](https://github.com/samvera/hydra-role-management/issues/34)
|
|
50
|
+
- Email as User id [#21](https://github.com/samvera/hydra-role-management/issues/21)
|
|
51
|
+
- roles generator messes up routes file [#9](https://github.com/samvera/hydra-role-management/issues/9)
|
|
52
|
+
|
|
53
|
+
**Merged pull requests:**
|
|
54
|
+
|
|
55
|
+
- Releases version 1.0.1 [#51](https://github.com/samvera/hydra-role-management/pull/51) ([jrgriffiniii](https://github.com/jrgriffiniii))
|
|
56
|
+
- Update CircleCI Ruby and Rails versions [#50](https://github.com/samvera/hydra-role-management/pull/50) ([botimer](https://github.com/botimer))
|
|
57
|
+
- Updates the CircleCI configuration to test against Rails release 5.1.7 and Ruby releases 2.6.3, 2.5.5, and 2.4.6 [#48](https://github.com/samvera/hydra-role-management/pull/48) ([jrgriffiniii](https://github.com/jrgriffiniii))
|
|
58
|
+
- Integrates CircleCI for continuous integration [#45](https://github.com/samvera/hydra-role-management/pull/45) ([jrgriffiniii](https://github.com/jrgriffiniii))
|
|
59
|
+
- Updating the dependencies to support bundler 2.0.x releases and to require engine_cart 2.1.x releases [#43](https://github.com/samvera/hydra-role-management/pull/43) ([jrgriffiniii](https://github.com/jrgriffiniii))
|
|
60
|
+
- Updating the Travis CI build matrix to use Ruby 2.5.1 and 2.4.4 along with Rails 5.2.1, 5.1.6, and 5.0.7 [#41](https://github.com/samvera/hydra-role-management/pull/41) ([jrgriffiniii](https://github.com/jrgriffiniii))
|
|
61
|
+
- Update docs according to templates [#40](https://github.com/samvera/hydra-role-management/pull/40) ([botimer](https://github.com/botimer))
|
|
62
|
+
- Integrating Bixby and RuboCop [#35](https://github.com/samvera/hydra-role-management/pull/35) ([jrgriffiniii](https://github.com/jrgriffiniii))
|
|
63
|
+
- Ensures that more complex Devise routes are not broken by the insertion of mount Hydra::RoleManagement::Engine => '/' [#33](https://github.com/samvera/hydra-role-management/pull/33) ([jrgriffiniii](https://github.com/jrgriffiniii))
|
|
64
|
+
- Use user.id instead of user in the path for the "Remove User" delete ... [#32](https://github.com/samvera/hydra-role-management/pull/32) ([coblej](https://github.com/coblej))
|
|
65
|
+
|
|
66
|
+
## [v1.0.0](https://github.com/samvera/hydra-role-management/tree/v1.0.0) (2017-11-02)
|
|
67
|
+
|
|
68
|
+
[Full Changelog](https://github.com/samvera/hydra-role-management/compare/v1.0...v1.0.0)
|
|
69
|
+
|
|
70
|
+
## [v1.0](https://github.com/samvera/hydra-role-management/tree/v1.0) (2017-11-02)
|
|
71
|
+
|
|
72
|
+
[Full Changelog](https://github.com/samvera/hydra-role-management/compare/v0.2.2...v1.0)
|
|
73
|
+
|
|
74
|
+
**Closed issues:**
|
|
75
|
+
|
|
76
|
+
- This gem is incompatible with Rails 5.1.2 migrations [#27](https://github.com/samvera/hydra-role-management/issues/27)
|
|
77
|
+
|
|
78
|
+
**Merged pull requests:**
|
|
79
|
+
|
|
80
|
+
- Tagging version 1.0 [#31](https://github.com/samvera/hydra-role-management/pull/31) ([bess](https://github.com/bess))
|
|
81
|
+
- Update build matrix and README [#30](https://github.com/samvera/hydra-role-management/pull/30) ([bess](https://github.com/bess))
|
|
82
|
+
- Add coveralls and travis badges [#29](https://github.com/samvera/hydra-role-management/pull/29) ([bess](https://github.com/bess))
|
|
83
|
+
- version user_roles migration template [#28](https://github.com/samvera/hydra-role-management/pull/28) ([dunn](https://github.com/dunn))
|
|
84
|
+
- Remove i18n-tasks for testing [#26](https://github.com/samvera/hydra-role-management/pull/26) ([elrayle](https://github.com/elrayle))
|
|
85
|
+
- Use translations for labels [#24](https://github.com/samvera/hydra-role-management/pull/24) ([elrayle](https://github.com/elrayle))
|
|
86
|
+
- Update engine_cart to 1.x [#23](https://github.com/samvera/hydra-role-management/pull/23) ([mjgiarlo](https://github.com/mjgiarlo))
|
|
87
|
+
- Stop spamming IRC with Travis builds [#22](https://github.com/samvera/hydra-role-management/pull/22) ([mjgiarlo](https://github.com/mjgiarlo))
|
|
88
|
+
|
|
89
|
+
## [v0.2.2](https://github.com/samvera/hydra-role-management/tree/v0.2.2) (2015-08-14)
|
|
90
|
+
|
|
91
|
+
[Full Changelog](https://github.com/samvera/hydra-role-management/compare/v0.2.1...v0.2.2)
|
|
92
|
+
|
|
93
|
+
**Closed issues:**
|
|
94
|
+
|
|
95
|
+
- License missing from gemspec [#7](https://github.com/samvera/hydra-role-management/issues/7)
|
|
96
|
+
|
|
97
|
+
**Merged pull requests:**
|
|
98
|
+
|
|
99
|
+
- Remove outdated cancan fix. [#20](https://github.com/samvera/hydra-role-management/pull/20) ([rotated8](https://github.com/rotated8))
|
|
100
|
+
- Fix indenting on the lines generated into the User class [#19](https://github.com/samvera/hydra-role-management/pull/19) ([jcoyne](https://github.com/jcoyne))
|
|
101
|
+
- Added Apache 2.0 License. Fixes #7 [#18](https://github.com/samvera/hydra-role-management/pull/18) ([jcoyne](https://github.com/jcoyne))
|
|
102
|
+
|
|
103
|
+
## [v0.2.1](https://github.com/samvera/hydra-role-management/tree/v0.2.1) (2014-12-18)
|
|
104
|
+
|
|
105
|
+
[Full Changelog](https://github.com/samvera/hydra-role-management/compare/v0.2.0...v0.2.1)
|
|
106
|
+
|
|
107
|
+
**Merged pull requests:**
|
|
108
|
+
|
|
109
|
+
- bumps version to '0.2.1' [#17](https://github.com/samvera/hydra-role-management/pull/17) ([mkorcy](https://github.com/mkorcy))
|
|
110
|
+
- Upgrade issues [#16](https://github.com/samvera/hydra-role-management/pull/16) ([mkorcy](https://github.com/mkorcy))
|
|
111
|
+
|
|
112
|
+
## [v0.2.0](https://github.com/samvera/hydra-role-management/tree/v0.2.0) (2014-06-25)
|
|
113
|
+
|
|
114
|
+
[Full Changelog](https://github.com/samvera/hydra-role-management/compare/v0.1.0...v0.2.0)
|
|
115
|
+
|
|
116
|
+
**Closed issues:**
|
|
117
|
+
|
|
118
|
+
- Decouple from hydra-head [#12](https://github.com/samvera/hydra-role-management/issues/12)
|
|
119
|
+
- don't depend on devise-guests [#10](https://github.com/samvera/hydra-role-management/issues/10)
|
|
120
|
+
|
|
121
|
+
**Merged pull requests:**
|
|
122
|
+
|
|
123
|
+
- Upgrade to boostrap_form (instead of bootstrap_forms) [#14](https://github.com/samvera/hydra-role-management/pull/14) ([val99erie](https://github.com/val99erie))
|
|
124
|
+
- Remove dependency on hydra-head. Fixes #12 [#13](https://github.com/samvera/hydra-role-management/pull/13) ([jcoyne](https://github.com/jcoyne))
|
|
125
|
+
- Don't check guest? unless DeviseGuests is installed. [#11](https://github.com/samvera/hydra-role-management/pull/11) ([jcoyne](https://github.com/jcoyne))
|
|
126
|
+
- Support drawing routes on a path other than /roles [#8](https://github.com/samvera/hydra-role-management/pull/8) ([mbklein](https://github.com/mbklein))
|
|
127
|
+
|
|
128
|
+
## [v0.1.0](https://github.com/samvera/hydra-role-management/tree/v0.1.0) (2013-09-24)
|
|
129
|
+
|
|
130
|
+
[Full Changelog](https://github.com/samvera/hydra-role-management/compare/v0.0.2...v0.1.0)
|
|
131
|
+
|
|
132
|
+
**Implemented enhancements:**
|
|
133
|
+
|
|
134
|
+
- Add documentation about needed cancan abilities [#2](https://github.com/samvera/hydra-role-management/issues/2)
|
|
135
|
+
|
|
136
|
+
**Merged pull requests:**
|
|
137
|
+
|
|
138
|
+
- Rails4 support [#6](https://github.com/samvera/hydra-role-management/pull/6) ([acurley](https://github.com/acurley))
|
|
139
|
+
- Redirect to edit when user can't edit all roles but can edit the current role [#5](https://github.com/samvera/hydra-role-management/pull/5) ([cjcolvar](https://github.com/cjcolvar))
|
|
140
|
+
- Allow renaming roles and deleting roles [#4](https://github.com/samvera/hydra-role-management/pull/4) ([cjcolvar](https://github.com/cjcolvar))
|
|
141
|
+
- Testing notes in README; newline before User model injection; require bootstrap_forms [#1](https://github.com/samvera/hydra-role-management/pull/1) ([cjcolvar](https://github.com/cjcolvar))
|
|
142
|
+
|
|
143
|
+
## [v0.0.2](https://github.com/samvera/hydra-role-management/tree/v0.0.2) (2013-04-18)
|
|
144
|
+
|
|
145
|
+
[Full Changelog](https://github.com/samvera/hydra-role-management/compare/v0.0.1...v0.0.2)
|
|
146
|
+
|
|
147
|
+
## [v0.0.1](https://github.com/samvera/hydra-role-management/tree/v0.0.1) (2013-04-18)
|
|
148
|
+
|
|
149
|
+
[Full Changelog](https://github.com/samvera/hydra-role-management/compare/0ab8d8ace4200cc7058e0cf1de77db6bb531ddf6...v0.0.1)
|
|
150
|
+
|
|
151
|
+
* _This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)_
|
data/Gemfile
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
source 'https://rubygems.org'
|
|
3
4
|
|
|
4
5
|
gem 'coveralls', require: false
|
|
5
6
|
|
|
@@ -8,8 +9,11 @@ gemspec
|
|
|
8
9
|
# BEGIN ENGINE_CART BLOCK
|
|
9
10
|
# engine_cart: 1.1.0
|
|
10
11
|
# engine_cart stanza: 0.10.0
|
|
11
|
-
# the below comes from engine_cart, a gem used to test this Rails engine gem
|
|
12
|
-
|
|
12
|
+
# the below comes from engine_cart, a gem used to test this Rails engine gem
|
|
13
|
+
# in the context of a Rails app.
|
|
14
|
+
file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] ||
|
|
15
|
+
ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app',
|
|
16
|
+
File.dirname(__FILE__)))
|
|
13
17
|
if File.exist?(file)
|
|
14
18
|
begin
|
|
15
19
|
eval_gemfile file
|
|
@@ -18,7 +22,8 @@ if File.exist?(file)
|
|
|
18
22
|
Bundler.ui.warn e.message
|
|
19
23
|
end
|
|
20
24
|
else
|
|
21
|
-
Bundler.ui.warn "[EngineCart]
|
|
25
|
+
Bundler.ui.warn "[EngineCart] Unmet dependencies in #{file}," \
|
|
26
|
+
' using placeholder dependencies'
|
|
22
27
|
|
|
23
28
|
if ENV['RAILS_VERSION']
|
|
24
29
|
if ENV['RAILS_VERSION'] == 'edge'
|
|
@@ -36,6 +41,8 @@ else
|
|
|
36
41
|
gem 'sass-rails', '>= 5.0'
|
|
37
42
|
when /^4.[01]/
|
|
38
43
|
gem 'sass-rails', '< 5.0'
|
|
44
|
+
when /^5.[12]/
|
|
45
|
+
gem 'sass-rails', '~> 5.0'
|
|
39
46
|
end
|
|
40
47
|
end
|
|
41
48
|
# END ENGINE_CART BLOCK
|
data/README.md
CHANGED
|
@@ -1,28 +1,20 @@
|
|
|
1
1
|
# hydra-role-management
|
|
2
2
|
|
|
3
|
-
Code:
|
|
4
|
-
[](https://circleci.com/gh/samvera/hydra-role-management)
|
|
5
|
-
[](https://badge.fury.io/rb/hydra-role-management)
|
|
6
|
-
[](https://coveralls.io/github/samvera/hydra-role-management?branch=master)
|
|
3
|
+
Code: [](https://circleci.com/gh/samvera/hydra-role-management) [](https://badge.fury.io/rb/hydra-role-management) [](https://coveralls.io/github/samvera/hydra-role-management?branch=master)
|
|
7
4
|
|
|
8
|
-
Docs:
|
|
9
|
-
[](./CONTRIBUTING.md)
|
|
10
|
-
[](./LICENSE.md)
|
|
5
|
+
Docs: [](./CONTRIBUTING.md) [](./LICENSE.md)
|
|
11
6
|
|
|
12
|
-
Jump In:
|
|
13
|
-
[](http://slack.samvera.org/)
|
|
7
|
+
Jump In: [](http://slack.samvera.org/)
|
|
14
8
|
|
|
15
9
|
# What is hydra-role-management?
|
|
16
10
|
|
|
17
|
-
An engine gem to provide a RDBMS backed list of roles and their associated user.
|
|
11
|
+
An engine gem to provide a RDBMS backed list of roles and their associated user. This replaces the hydra default role mapper.
|
|
18
12
|
|
|
19
13
|
As of version 1.0, this gem only supports Rails 5.
|
|
20
14
|
|
|
21
15
|
## Product Owner & Maintenance
|
|
22
16
|
|
|
23
|
-
**hydra-role-management** is a Core Component of the Samvera community. The documentation for
|
|
24
|
-
what this means can be found
|
|
25
|
-
[here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
|
|
17
|
+
**hydra-role-management** is a Core Component of the Samvera community. The documentation for what this means can be found [here](http://samvera.github.io/core_components.html#requirements-for-a-core-component).
|
|
26
18
|
|
|
27
19
|
### Product Owner
|
|
28
20
|
|
|
@@ -34,10 +26,10 @@ The Samvera community is here to help. Please see our [support guide](./SUPPORT.
|
|
|
34
26
|
|
|
35
27
|
## Installing:
|
|
36
28
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
29
|
+
- Add: `gem 'hydra-role-management'` to your Gemfile and then `bundle install`
|
|
30
|
+
- `rails generate roles`
|
|
31
|
+
- `rake db:migrate`
|
|
32
|
+
- Add the following [cancan](https://github.com/ryanb/cancan) abilities:
|
|
41
33
|
|
|
42
34
|
```
|
|
43
35
|
# app/models/ability.rb
|
|
@@ -48,17 +40,35 @@ The Samvera community is here to help. Please see our [support guide](./SUPPORT.
|
|
|
48
40
|
|
|
49
41
|
## Testing:
|
|
50
42
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
43
|
+
- Install a system javascript runtime or uncomment therubyracer in spec/support/Gemfile
|
|
44
|
+
- Ensure that the testing app does not exist: `bundle exec rake engine_cart:clean`
|
|
45
|
+
- Set Rails version you want to test against. For example:
|
|
46
|
+
|
|
47
|
+
- `export RAILS_VERSION=5.1.4`
|
|
48
|
+
|
|
49
|
+
- Ensure that the correct version of Rails is installed: `bundle update`
|
|
50
|
+
|
|
51
|
+
- Build test app: `bundle exec rake engine_cart:generate`
|
|
52
|
+
|
|
53
|
+
- And run tests: `bundle exec rake ci`
|
|
54
|
+
|
|
55
|
+
## Releasing
|
|
56
|
+
|
|
57
|
+
1. `bundle install`
|
|
58
|
+
2. Increase the version number in `lib/hydra/role_management/version.rb`
|
|
59
|
+
3. Increase the same version number in `.github_changelog_generator`
|
|
60
|
+
4. Update `CHANGELOG.md` by running this command:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
github_changelog_generator --user samvera --project hydra-role-management --token YOUR_GITHUB_TOKEN_HERE
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
5. Commit these changes to the master branch
|
|
67
|
+
|
|
68
|
+
6. Run `rake release`
|
|
58
69
|
|
|
59
70
|
# Acknowledgments
|
|
60
71
|
|
|
61
|
-
This software has been developed by and is brought to you by the Samvera community.
|
|
62
|
-
[Samvera website](http://samvera.org/).
|
|
72
|
+
This software has been developed by and is brought to you by the Samvera community. Learn more at the [Samvera website](http://samvera.org/).
|
|
63
73
|
|
|
64
74
|

|
data/Rakefile
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
module Hydra
|
|
3
4
|
module RoleManagement
|
|
4
5
|
# Module defining Controller actions for creating and managing Roles
|
|
@@ -22,7 +23,8 @@ module Hydra
|
|
|
22
23
|
def create
|
|
23
24
|
@role = Role.new(role_params)
|
|
24
25
|
if @role.save
|
|
25
|
-
redirect_to role_management.edit_role_path(@role),
|
|
26
|
+
redirect_to role_management.edit_role_path(@role),
|
|
27
|
+
notice: 'Role was successfully created.'
|
|
26
28
|
else
|
|
27
29
|
render action: 'new'
|
|
28
30
|
end
|
|
@@ -31,7 +33,8 @@ module Hydra
|
|
|
31
33
|
def update
|
|
32
34
|
@role = Role.find(params[:id])
|
|
33
35
|
if @role.update_attributes(role_params)
|
|
34
|
-
redirect_to role_management.edit_role_path(@role),
|
|
36
|
+
redirect_to role_management.edit_role_path(@role),
|
|
37
|
+
notice: 'Role was successfully updated.'
|
|
35
38
|
else
|
|
36
39
|
render action: 'edit'
|
|
37
40
|
end
|
|
@@ -39,7 +42,8 @@ module Hydra
|
|
|
39
42
|
|
|
40
43
|
def destroy
|
|
41
44
|
if @role.destroy
|
|
42
|
-
redirect_to role_management.roles_path,
|
|
45
|
+
redirect_to role_management.roles_path,
|
|
46
|
+
notice: 'Role was successfully deleted.'
|
|
43
47
|
else
|
|
44
48
|
redirect_to role_management.roles_path
|
|
45
49
|
end
|
|
@@ -47,13 +51,13 @@ module Hydra
|
|
|
47
51
|
|
|
48
52
|
private
|
|
49
53
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
end
|
|
54
|
+
def role_params
|
|
55
|
+
if !ActionController.const_defined? :StrongParameters
|
|
56
|
+
params[:role]
|
|
57
|
+
else
|
|
58
|
+
params.require(:role).permit(:name)
|
|
56
59
|
end
|
|
60
|
+
end
|
|
57
61
|
end
|
|
58
62
|
end
|
|
59
63
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
module Hydra
|
|
3
4
|
module RoleManagement
|
|
4
5
|
# Module defining Controller actions for adding and managing Roles for Users
|
|
@@ -17,7 +18,8 @@ module Hydra
|
|
|
17
18
|
u.save!
|
|
18
19
|
redirect_to role_management.role_path(@role)
|
|
19
20
|
else
|
|
20
|
-
redirect_to role_management.role_path(@role),
|
|
21
|
+
redirect_to role_management.role_path(@role),
|
|
22
|
+
flash: { error: "Invalid user #{params[:user_key]}" }
|
|
21
23
|
end
|
|
22
24
|
end
|
|
23
25
|
|
|
@@ -29,13 +31,13 @@ module Hydra
|
|
|
29
31
|
|
|
30
32
|
protected
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
def find_user
|
|
35
|
+
::User.send("find_by_#{find_column}".to_sym, params[:user_key])
|
|
36
|
+
end
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
def find_column
|
|
39
|
+
Devise.authentication_keys.first
|
|
40
|
+
end
|
|
39
41
|
end
|
|
40
42
|
end
|
|
41
43
|
end
|
data/app/models/role.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
# Class modeling Roles within the application
|
|
3
4
|
class Role < ActiveRecord::Base
|
|
4
5
|
has_and_belongs_to_many :users
|
|
@@ -7,6 +8,7 @@ class Role < ActiveRecord::Base
|
|
|
7
8
|
uniqueness: true,
|
|
8
9
|
format: {
|
|
9
10
|
with: /\A[a-zA-Z0-9._-]+\z/,
|
|
10
|
-
message: 'Only letters, numbers, hyphens,
|
|
11
|
+
message: 'Only letters, numbers, hyphens, ' \
|
|
12
|
+
'underscores and periods are allowed'
|
|
11
13
|
}
|
|
12
14
|
end
|
data/config/routes.rb
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
Hydra::RoleManagement::Engine.routes.draw do
|
|
3
4
|
# Generic file routes
|
|
4
5
|
resources :roles, Hydra::RoleManagement.route_options do
|
|
5
|
-
resources :users, only: [
|
|
6
|
+
resources :users, only: %i[create destroy], controller: 'user_roles'
|
|
6
7
|
end
|
|
7
8
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
require File.expand_path('../lib/hydra/role_management/version', __FILE__)
|
|
3
4
|
|
|
4
5
|
Gem::Specification.new do |gem|
|
|
@@ -23,6 +24,7 @@ Gem::Specification.new do |gem|
|
|
|
23
24
|
gem.add_dependency 'json', '>= 1.8'
|
|
24
25
|
gem.add_development_dependency 'bixby', '~> 1.0.0'
|
|
25
26
|
gem.add_development_dependency 'engine_cart', '~> 2.1'
|
|
27
|
+
gem.add_development_dependency 'github_changelog_generator'
|
|
26
28
|
gem.add_development_dependency 'pry-byebug'
|
|
27
29
|
gem.add_development_dependency 'rails-controller-testing', '~> 0'
|
|
28
30
|
gem.add_development_dependency 'rake'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
# frozen_string_literal: true
|
|
3
|
+
|
|
3
4
|
require 'rails/generators'
|
|
4
5
|
require 'rails/generators/migration'
|
|
5
6
|
|
|
@@ -74,10 +75,10 @@ This generator makes the following changes to your application:
|
|
|
74
75
|
|
|
75
76
|
private
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
def better_migration_template(file)
|
|
79
|
+
sleep 1 # ensure scripts have different time stamps
|
|
80
|
+
migration_template "migrations/#{file}", "db/migrate/#{file}"
|
|
81
|
+
rescue StandardError
|
|
82
|
+
Rails.logger.error " \e[1m\e[34mMigrations\e[0m " + $ERROR_INFO.message
|
|
83
|
+
end
|
|
83
84
|
end
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
class UserRoles < ActiveRecord::Migration[5.0]
|
|
3
4
|
def up
|
|
4
5
|
create_table :roles do |t|
|
|
@@ -8,8 +9,8 @@ class UserRoles < ActiveRecord::Migration[5.0]
|
|
|
8
9
|
t.references :role
|
|
9
10
|
t.references :user
|
|
10
11
|
end
|
|
11
|
-
add_index :roles_users, [
|
|
12
|
-
add_index :roles_users, [
|
|
12
|
+
add_index :roles_users, %i[role_id user_id]
|
|
13
|
+
add_index :roles_users, %i[user_id role_id]
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
def down
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
require 'hydra/role_management'
|
|
3
4
|
require 'bootstrap_form'
|
|
4
5
|
|
|
@@ -9,7 +10,7 @@ module Hydra
|
|
|
9
10
|
|
|
10
11
|
# Draws the routes with custom arguments passed to the #mount invocation
|
|
11
12
|
# @param router [ActionDispatch::Routing::Mapper] the Rails routing mapper
|
|
12
|
-
# @param opts [Hash]
|
|
13
|
+
# @param opts [Hash] passed to ActionDispatch::Routing::Mapper#mount
|
|
13
14
|
# @see http://api.rubyonrails.org/classes/ActionDispatch/Routing/Mapper/Base.html
|
|
14
15
|
# (see ActionDispatch::Routing::Mapper::Base)
|
|
15
16
|
def self.draw_routes(router, opts = {})
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
describe UserRolesController do
|
|
3
4
|
let(:ability) do
|
|
4
5
|
ability = Object.new
|
|
@@ -37,7 +38,7 @@ describe UserRolesController do
|
|
|
37
38
|
allow(User).to receive(:find_by_email).and_return(nil)
|
|
38
39
|
post :create, params: { role_id: role, user_key: 'foo@example.com' }
|
|
39
40
|
expect(User).to have_received(:find_by_email).with('foo@example.com')
|
|
40
|
-
expect(flash[:error]).to eq '
|
|
41
|
+
expect(flash[:error]).to eq 'Invalid user foo@example.com'
|
|
41
42
|
end
|
|
42
43
|
it 'is able to add a user' do
|
|
43
44
|
u = User.create!(email: 'foo@example.com', password: 'password', password_confirmation: 'password')
|
data/spec/lib/user_roles_spec.rb
CHANGED
data/spec/models/role_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
|
+
|
|
2
3
|
# The following lines determine which user attributes your hydrangea app will use
|
|
3
4
|
# This configuration allows you to use the out of the box ActiveRecord associations between users and user_attributes
|
|
4
5
|
# It also allows you to specify your own user attributes
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hydra-role-management
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0.
|
|
4
|
+
version: 1.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Coyne
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: blacklight
|
|
@@ -108,6 +108,20 @@ dependencies:
|
|
|
108
108
|
- - "~>"
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '2.1'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: github_changelog_generator
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
111
125
|
- !ruby/object:Gem::Dependency
|
|
112
126
|
name: pry-byebug
|
|
113
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -200,6 +214,7 @@ extensions: []
|
|
|
200
214
|
extra_rdoc_files: []
|
|
201
215
|
files:
|
|
202
216
|
- ".circleci/config.yml"
|
|
217
|
+
- ".github_changelog_generator"
|
|
203
218
|
- ".gitignore"
|
|
204
219
|
- ".rspec"
|
|
205
220
|
- ".rubocop.yml"
|
|
@@ -261,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
261
276
|
- !ruby/object:Gem::Version
|
|
262
277
|
version: '0'
|
|
263
278
|
requirements: []
|
|
264
|
-
rubygems_version: 3.
|
|
279
|
+
rubygems_version: 3.1.2
|
|
265
280
|
signing_key:
|
|
266
281
|
specification_version: 4
|
|
267
282
|
summary: Rails engine to do user roles in an RDBMS for hydra-head
|