Metadecidim
Sign in

Process

Co-creating the roadmap 2025–2027

finished not yet on protocol

Possibility to force login before accessing the platform

May be against the "open democracy" ideology and all but we have modified a Decidim instance which requires users to log in before they can access any page in the system.

The reason is that the organization wanted to use Decidim's features openly within their organization but they don't want anyone outside of their organization to be able to access this information. They have e.g. idea collection there that may be a violation to employee's privacy in case that information was public but within that organization, it is OK to be visible for all.

Therefore, I think this should be a feature in Decidim, it would open up new use cases for the system as an open democracy tool for oranizations like "Let your employees participate to the decision making inside your organization".

This could be a configuration under the "system admin" panel where you would check a box which would then force users to log in as in the example screenshot.

Documents

20 comments

  1. Would be useful for organizations that want to do collaborative decision making. Did you come up with some /system config to whitelist a particular domain or list of email ?

    0 votes up 0 votes down
    1. We just added a new configuration flag in the config/application.rb (or any of the environment configs) that forces login.

      Changes that we did in Decidim with this flag:
      - Modify the views/layouts/decidim/_wrapper.html.erb to hide the common elements if the user is not logged in in case the flag is enabled. This check happens through an application helper that we added.
      - Added a new before action in the application controller to check if that configuration flag is enabled. If yes, redirect the user to the new_user_session_path in case they are not authenticated.

      So for now, this is just a hard coded "quick fix" but I was just thinking for wider use, it could be an organization specific config you could configure through the system admin UI. The attached mockup is just done with the element inspector in the browser.

      0 votes up 0 votes down
    2. And another change we also did is that we disabled signing up to the system for that instance since they are using their internal OpenID connect based authentication method to verify that the users are who they want them to be.

      0 votes up 0 votes down
  2. There are instances of Decidim doing something similar (for example Fundaction https://assembly.fundaction.eu) Maybe you can check its solution. But it seems something useful for organizations who don't want to share publicly their activity.

    0 votes up 0 votes down
    1. Where can I find the source code for this instance, would be interested to take a look.

      They have probably done something similar as what we did (i.e. adding the before action) but we also added a layout modification to hide the menus/other content before the user is logged in.

      0 votes up 0 votes down
      1. https://github.com/ElectricThings/fund_action

        1 votes up 0 votes down
        1. Thanks!

          From that repository I can find the following changes they have done to achieve this:

          - Added a new before action in application controller as we did as well. But they didn't make it configurable, it is just hard coded for this instance.
          - Added redirects to the sign_up and profile editing paths to root in the config/routes.rb. We just handled this all on the controller level.
          - The have made their own Decidim fork to remove the sign in link from the header. We just hid the whole top bar before the user is logged in instance specifically (in case the configuration option is enabled) + removed the "registerable" module from Decidim::User.

          The last change is not optimal as it adds a small overhead to their Decidim upgrade process.

          0 votes up 0 votes down
  3. But this feature can be achieved by configuring only a BASIC Auth on the Apache server for example, or any other proxy in front of Decidim isn't it?

    0 votes up 0 votes down
    1. Yes, but it makes the experience much harder for the end users if they need to do two separate authentications. That will be a big hurdle for non technical users.

      Also, this instance of Decidim is already integrated to their own Active Directory based user authentication system, so the process for them is very clear generally:
      1. Go to web page
      2. Click sign in
      3. Enter the same credentials you use to login to your computer (this is skipped if you're not already authenticated)
      4. Ta-da

      2 votes up 0 votes down
      1. Correction above: this is skipped if you ARE already authenticated

        0 votes up 0 votes down
    2. @, I think BASIC Auth doesn't solve the issue, keep in mind a Decidim installation with multitenant instances where not all of them want a login nor share credentials between organizations.

      Apart from the UX for the end users (as said by @ah) and the system admins.

      0 votes up 0 votes down
  4. Hi @product ! at @coditramuntana we need this feature (force login to view any content), do you know if is this been developed as a module?

    If not, are you interested to add it to decidm/decidim?

    1 votes up 1 votes down
    1. as mentioning to product (user_group) seems it doesn't work, I'll ping @andres , @carol , @arnau and @josanffig

      Funding is available for developing this feature

      0 votes up 0 votes down
    2. As far as I know, there is no module available for this.

      For the Helsinki instance we have developed a hack to allow configuring this per environment:
      https://github.com/City-of-Helsinki/decidim-helsinki/blob/27a7b3504f16489c7145051210d885824e38d9fd/config/application.rb#L35-L42

      You can search through the code base with that flag (`use_mode`) to see the changes.

      Would be good if this was configurable through Decidim per organization (as suggested).

      1 votes up 0 votes down
      1. Thanks for your response @ah ,

        yes it will be configurable per organization/tenant

        0 votes up 0 votes down
  5. In favour

    Feature proposal accepted, Great News! 😊

    0 votes up 0 votes down
  6. Currently having an issue with this. Didn't check such option, however every user access attempt is forced to the login page.

    1 votes up 0 votes down
    1. Yeah, That's really good option to have. do you face any difficulties with enabling that option?

      0 votes up 0 votes down
      1. Well, didn't want to enable but that's the behaviour I got. Even without checking the option. Weird, to me at least.

        0 votes up 0 votes down
        1. 1. Try to enable it (do the opposite thing) thrn restart the rails
          rails/bin restart
          service nginx restart
          Then see the results, if still you have it then do the opposite and restart the rail and nginx if got nothing then you have to find that configuration it could stored in a file or in the database thdn go and change it manually.
          Make sure to restart everything after applying the configuration.
          Good luck.

          0 votes up 0 votes down

Sign in with your Atmosphere account to comment.