Skip to content

Add create authorization to initiative types#9309

Merged
ahukkanen merged 27 commits intodecidim:developfrom
eliegaboriau:add_create_authorization_to_initiative_types
Jul 8, 2022
Merged

Add create authorization to initiative types#9309
ahukkanen merged 27 commits intodecidim:developfrom
eliegaboriau:add_create_authorization_to_initiative_types

Conversation

@eliegaboriau
Copy link
Copy Markdown
Contributor

@eliegaboriau eliegaboriau commented May 17, 2022

🎩 What? Why?

This PR offers the possibility to add an authorization handler on the creation of initiatives, according to the initiative type.
It asks for the authorization when choosing the initiative type, if an authorization handler has been chosen.
If there's only one initiative type, it asks for the authorization when clicking on "new initiative"

📌 Related Issues

Link your PR to an issue

Testing

Describe the best way to test or validate your PR.
- Go to admin initiative type list
- Click on permissions for one
- Change the create permissions
- Go to initiative
- Click on create initiative
- See that under the initiative type you changed, it's written "verify your account to promote this initiative"
- Click on it
- See that it asks for an authorization

📋 Checklist

🚨 Please review the guidelines for contributing to this repository.

  • CONSIDER adding a unit test if your PR resolves an issue.
  • ✔️ DO check open PR's to avoid duplicates.
  • ✔️ DO keep pull requests small so they can be easily reviewed.
  • ✔️ DO build locally before pushing.
  • ✔️ DO make sure tests pass.
  • ✔️ DO make sure any new changes are documented in docs/.
  • ✔️ DO add and modify seeds if necessary.
  • ✔️ DO add CHANGELOG upgrade notes if required.
  • ✔️ DO add to GraphQL API if there are new public fields.
  • ✔️ DO add link to MetaDecidim if it's a new feature.
  • AVOID breaking the continuous integration build.
  • AVOID making significant changes to the overall architecture.

📷 Screenshots

Please add screenshots of the changes you're proposing
The screenshots are in the issue

♥️ Thank you!

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @eliegaboriau !

I just have one question, see below. I understand that you may have a valid reason to do this but just for me to understand us well, could you please explain?

@eliegaboriau
Copy link
Copy Markdown
Contributor Author

Looks great, thanks @eliegaboriau !

It's actually not that great, we've seen that it's depend a lot on the "do not require authorization" configuration.
I'm gonna draft it to rewrite the spec

@eliegaboriau eliegaboriau marked this pull request as draft June 14, 2022 16:00
@ahukkanen
Copy link
Copy Markdown
Contributor

@eliegaboriau Also a kind reminder to you that we are planning releasing 0.27 RC1 next week so if you'd like to incorporate this into the next release, we would need to get this done shortly.

If you cannot finish it shortly, no worries! It will then be part of the 0.28 release.

@eliegaboriau
Copy link
Copy Markdown
Contributor Author

@eliegaboriau Also a kind reminder to you that we are planning releasing 0.27 RC1 next week so if you'd like to incorporate this into the next release, we would need to get this done shortly.

If you cannot finish it shortly, no worries! It will then be part of the 0.28 release.

Hello @ahukkanen
I'm trying to add everything i want to add today, hopefully we can add this in the next release

eliegaboriau and others added 2 commits June 20, 2022 16:57
@eliegaboriau eliegaboriau marked this pull request as ready for review June 20, 2022 14:58
@eliegaboriau
Copy link
Copy Markdown
Contributor Author

@ahukkanen It's okay for me, let me know if something's missing !

@ahukkanen
Copy link
Copy Markdown
Contributor

@eliegaboriau There is one conflict, could you please resolve?

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed one issue after the latest changes, could you please move the reveal to its own partial?

Also, there are some conflicts, could you resolve those?

After #9347, we also changed the default password to decidim123456789, so we also need to apply this change to the specs where you are logging in.

eliegaboriau and others added 9 commits June 23, 2022 10:48
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
@eliegaboriau
Copy link
Copy Markdown
Contributor Author

It should be okay now !

Copy link
Copy Markdown
Contributor

@ahukkanen ahukkanen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this and this works great!

The UX flow just feels weird when doing the following:

  • Require authorization for initiative type creation (e.g. use the example authorization with the default configuration)
  • Login with an unauthorized user account
  • Go to create an initiative of the type that requires the authorization that you configured
  • Authorize the user with the required authorization but provide authorization data that does not match the configurations of the configured authorization (e.g. use a different postal code than the required one)

After authorizing the account, I now see this:
Authorization success

If this happened, I would rather see some error message that my authorization data does not match the requirements.

But I also understand it is not in the scope of this PR, so we probably cannot do much about it. This is just how the authorizations work as they are decoupled from the sections that may or may not require an authorization.

When I click the "Verify your account to promote this initiative", I correctly see this popup as expected:
Not authorized modal

Therefore, I still get the information why I cannot vote but just the UX is pretty weird after the authorization action.

Regarding this particular PR, it's all good.

Even though this PR touches the participant facing UI, I will merge this as this has been already implemented way before the redesign guidelines were published and there were just some code cleanup happening at the final stage of the review. Also, the initiatives redesign has not started yet so I believe it won't do any harm merging this now.

Also FYI @eliegaboriau, for any further PRs, the guidelines are available at #9512 (if you didn't already know).

@ahukkanen ahukkanen merged commit 56c1986 into decidim:develop Jul 8, 2022
eliegaboriau added a commit to eliegaboriau/decidim that referenced this pull request Oct 25, 2022
* first version

* fix i18n

* linter

* linter

* fix permissions
fix test

* fix tests
add button when initiative type doesn't need an authorisation but initiative does

* lint

* lint

* change requests

* refactor

* linter

* Improve spec
Fix not authorized modal when choosing initiative type

* linter

* linter

* add refresh when needed

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* refactor modal in partial

* linter

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
@jorgeatgu jorgeatgu mentioned this pull request May 25, 2023
2 tasks
fblupi pushed a commit to AjuntamentdeBarcelona/decidim that referenced this pull request Feb 26, 2024
* first version

* fix i18n

* linter

* linter

* fix permissions
fix test

* fix tests
add button when initiative type doesn't need an authorisation but initiative does

* lint

* lint

* change requests

* refactor

* linter

* Improve spec
Fix not authorized modal when choosing initiative type

* linter

* linter

* add refresh when needed

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* refactor modal in partial

* linter

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
fblupi pushed a commit to AjuntamentdeBarcelona/decidim that referenced this pull request Feb 26, 2024
* first version

* fix i18n

* linter

* linter

* fix permissions
fix test

* fix tests
add button when initiative type doesn't need an authorisation but initiative does

* lint

* lint

* change requests

* refactor

* linter

* Improve spec
Fix not authorized modal when choosing initiative type

* linter

* linter

* add refresh when needed

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* Update decidim-initiatives/spec/system/create_initiative_spec.rb

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>

* refactor modal in partial

* linter

Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure authorization for initiative creation

2 participants