-
-
Notifications
You must be signed in to change notification settings - Fork 392
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Seed org with available authorizations #1978
Seed org with available authorizations #1978
Conversation
b7b1465
to
fd51e73
Compare
Codecov Report
@@ Coverage Diff @@
## master #1978 +/- ##
==========================================
- Coverage 98.48% 98.47% -0.01%
==========================================
Files 1145 1144 -1
Lines 25737 25722 -15
==========================================
- Hits 25346 25331 -15
Misses 391 391 |
fd51e73
to
bfade43
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! @josepjaume what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me as well! Good job!
Maybe we should add some documentation about the available generators at some point? I'm sure this would have popped out before if we had tried to rationalize it on a README :)
Should we add a CHANGELOG entry here? |
Transforming an existing application like this is very prone to errors and not that simple. For example, if there are existing authorization handlers already saved in DB (in either organizations or authorizations), they would need to be migrated or we would get crashes all around. So the current version of this generator is only ready to be used for direct app generator. So I merged it with the regular generator and made it accessible by passing the --demo flag to it.
f399e1e
bfade43
to
f399e1e
Compare
馃帺 What? Why?
I'm doing a lot of manual testing with authorizations. Right now this is a bit tedious because the default organization is not seeded with the available handlers, so you have to go to /system, enable them, then go to admin and enable handlers for the actions, and then you can finally test the handler. This changes improve this by adding the available authorizations to the organization when seeding.
Since the "demo generator" (where the dummy authorization handler is setup) is run after seeding, I couldn't easily fix this by just adding it to seeds. So I decided to merge the demo generator with the main generator so by the time of seeding authorization handlers have been correctly setup. Instead, you can now pass
--demo
to the generator if you want a demo handler (authorizes ID documents ended with "X"), or the default (an example handler with documentation that by default just authorizes everything).I think this is a good move anyways because:
bin/rails g decidim:demo
on an existing application, running it can lead to crashes if there is existing authorization data in DB.馃搶 Related Issues
None.
馃搵 Subtasks
None.
馃摲 Screenshots (optional)
None.
馃懟 GIF