{"id":51142153,"url":"https://github.com/gencat/decidim-module-department_admin","last_synced_at":"2026-07-14T07:01:29.712Z","repository":{"id":41181155,"uuid":"178373923","full_name":"gencat/decidim-module-department_admin","owner":"gencat","description":"This Dedicim's module produces a new \"department admin\" role which allows a User to administer the ParticipatorySpaces of a given Area.","archived":false,"fork":false,"pushed_at":"2026-07-07T11:56:33.000Z","size":528,"stargazers_count":2,"open_issues_count":1,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-07-07T13:21:00.726Z","etag":null,"topics":["decidim","decidim-module","hacktoberfest","rails","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gencat.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE-AGPLv3.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-03-29T09:23:41.000Z","updated_at":"2026-04-15T06:25:18.000Z","dependencies_parsed_at":"2026-05-05T16:01:10.595Z","dependency_job_id":null,"html_url":"https://github.com/gencat/decidim-module-department_admin","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"purl":"pkg:github/gencat/decidim-module-department_admin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gencat%2Fdecidim-module-department_admin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gencat%2Fdecidim-module-department_admin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gencat%2Fdecidim-module-department_admin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gencat%2Fdecidim-module-department_admin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gencat","download_url":"https://codeload.github.com/gencat/decidim-module-department_admin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gencat%2Fdecidim-module-department_admin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35450066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-14T02:00:06.603Z","response_time":114,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decidim","decidim-module","hacktoberfest","rails","ruby"],"created_at":"2026-06-26T00:00:40.441Z","updated_at":"2026-07-14T07:01:29.707Z","avatar_url":"https://github.com/gencat.png","language":"Ruby","funding_links":[],"categories":["Administración y Gobierno"],"sub_categories":[],"readme":"# Decidim::DepartmentAdmin\n\nThis Dedicim's module produces a new \\\"department admin\\\" role which restricts the permissions of an Admin into participatory spaces of a given Area.\n\nThe module currently only affects the following participatory spaces and admin blocks:\n\n- Participatory Processes: administer processes with the same area as the user's one.\n- Assemblies: administer assemblies with the same area as the user's one.\n- Newsletters: send newsletters to participants in the spaces with the same area as user's one.\n- Conferences: administer conferences with the same area as the user's one.\n\n## Usage\n\nDepartmentAdmin will only affect users with the \"department admin\" role. The rest of the users should behave as usual.\n\nTo create a user with a department admin role, go to admin panel/PARTICIPANTS/Administrators/New Participant. There, select the \"Administrador de departament\" role, and then the area. Finally Invite the user.\n\n## Installation\n\nAdd this line to your application's Gemfile if you would like to always have the latest (edge) version:\n\n```ruby\ngem \"decidim-department_admin\", git: \"https://github.com/gencat/decidim-module-department-admin.git\"\n```\n\nOr, add a line like the following to your application's Gemfile if you would like to have the latest stable from the version of your choice, in this case `0.4.x`:\n\n```ruby\ngem \"decidim-department_admin\", \"~\u003e 0.4.2\", git: \"https://github.com/gencat/decidim-module-department-admin.git\"\n```\n\nEdit your app's `config/application.rb` file to enforce railties ordering:\n```ruby\nmodule YourDecidimApp\n  class Application \u003c Rails::Application\n\n...\n    config.railties_order = [:main_app, ::Decidim::DepartmentAdmin::Engine, :all]\n...\n\n  end\nend\n```\n\nAnd then execute:\n\n```bash\nbundle\nbundle exec rails decidim_department_admin:install:migrations\nbundle exec rails db:migrate\n```\n\n## Overrides\nBeware that this module overrides many core features of Decidim. Thus, modified features may have required to override, change or extend source code from Decidim.\n\nMost of the times the overrides and modifications will be found in `app/decorators`.\n\n## How it works\nAlthough some other artifacts exist, the key places to search for in this module are 3:\n- lib/decidim/department_admin/engine.rb\n- app/permissions/decidim/department_admin/permissions.rb\n- app/decorators\n\n### Engine\nThe mission of the Engine in this module is to reconfigure the permissions_registry for some artifacts so that they depend upon `Decidim::DepartmentAdmin::Permissions` instead of their standard permissions chain.\n\nThe engine also configures de `app/decorators` directory to be loaded during rails initialization.\n\n### Custom Permissions\nThe `Decidim::DepartmentAdmin::Permissions` class is the responsible to allow all permissions related with the \"departmen admin\" role.\n\n`Decidim::Assemblies::ParticipatorySpacePermissions`, `Decidim::ParticipatoryProcesses::ParticipatorySpacePermissions` and\n`Decidim::Conferences::ParticipatorySpacePermissions` are subclassing `Decidim::DepartmentAdmin::Permissions` in order to force the permissions classes where they delegate.\n\n### Decorators\nInside `app/decorators` there are all the tricks done in order for department_admin module to work.\n\nAll decorator artifacts are extensions or modifications to the standard Decidim behavior.\n\n### Temporal fixes\n\n#### Temporal fix: added \u0026 in case role_name check.\n\nCurrently, in the file:\n- lib/decidim/participatory_space_resourceable.rb\nwe have overridden `user_role_config_for` method, in role_name case check.\n\nThe reason for this, is that this method is called from `user_role_config` in `Decidim::Admin::UserRolesHelper` file, with second param `role_name` that can be nil as it is called as `role\u0026.role`.\nThis happens only when logged in user is Departmental Admin type and this can be possible because this module is only available in this repo.\nSo, to avoid error when role_name passed is nil, we override this param check with a simple `role_name\u0026.to_sym`\n\nIn next versions, this issue will be patched in `decidim/decidim`, so this override could be removed:\n- lib/decidim/participatory_space_resourceable.rb\n\n### Run tests\n\nCreate a dummy app in your application (if not present):\n\n```bash\nbin/rails decidim:generate_external_test_app\ncd spec/decidim_dummy_app/\nbundle exec rails decidim_department_admin:install:migrations\nRAILS_ENV=test bundle exec rails db:migrate\nsed -ie '/^  class Application \u003c Rails::Application/a config.railties_order = [:main_app, ::Decidim::DepartmentAdmin::Engine, :all]' config/application.rb\n```\n\nThis last line modifies dummy_app's `config/application.rb` file to enforce railties ordering, adding:\n```ruby\nmodule DecidimDepartmentAdminTestApp\n  class Application \u003c Rails::Application\n    config.railties_order = [:main_app, ::Decidim::DepartmentAdmin::Engine, :all]\n...\n\n  end\nend\n```\n\nAnd run tests:\n\n```bash\nbundle exec rspec spec\n```\n\n## Contributing\n\nSee [Decidim](https://github.com/decidim/decidim).\n\n## License\n\nThis engine is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.\n\nAuthored by [CodiTramuntana](http://coditramuntana.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgencat%2Fdecidim-module-department_admin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgencat%2Fdecidim-module-department_admin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgencat%2Fdecidim-module-department_admin/lists"}