decidim-system 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-system might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +45 -8
- data/app/commands/decidim/system/register_organization.rb +3 -0
- data/app/commands/decidim/system/update_organization.rb +2 -0
- data/app/controllers/decidim/system/application_controller.rb +2 -0
- data/app/forms/decidim/system/register_organization_form.rb +1 -0
- data/app/forms/decidim/system/update_organization_form.rb +18 -0
- data/app/views/decidim/system/organizations/edit.html.erb +10 -0
- data/app/views/decidim/system/organizations/new.html.erb +33 -19
- data/config/locales/ca.yml +3 -0
- data/config/locales/en.yml +3 -0
- data/config/locales/es.yml +3 -0
- data/config/locales/eu.yml +3 -0
- data/config/locales/fi.yml +68 -0
- data/db/seeds.rb +1 -1
- data/lib/decidim/system/engine.rb +1 -0
- metadata +11 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c1e17e92f4d745c061701294e94aa16f21c2c2b
|
4
|
+
data.tar.gz: 6eee551e0453c5e95d03ae3bf0f1ab4c562e042c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2da66c51684f0885600c8262662de381eab489a1a0bf4a2d633b0bcf41a3be71f16190eac8a29e7184a705e97dc86cdd07ff9ec16b55ab07e35874b87b7a3ad5
|
7
|
+
data.tar.gz: bc71de0f4c691aeaecd41dce1479c4d8131ab86f01ad47e4608dd1b1de48077f5dbee2205337ce7404bea9370b2ed1200c3f1afe67c5728a8ddb1b60eb4b6672
|
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
# Decidim::System
|
2
|
-
|
2
|
+
|
3
|
+
This engine adds an administration dashboard so admin can manage a Decidim deploy
|
4
|
+
and its organizations when working in a multi-tenant environment.
|
3
5
|
|
4
6
|
## Usage
|
5
|
-
How to use my plugin.
|
6
7
|
|
7
|
-
|
8
|
+
`decidim-system` is already included in the `decidim` gem, but you can also include it separately:
|
9
|
+
|
8
10
|
Add this line to your application's Gemfile:
|
9
11
|
|
10
12
|
```ruby
|
@@ -16,13 +18,48 @@ And then execute:
|
|
16
18
|
$ bundle
|
17
19
|
```
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
21
|
+
## Multi-tenancy in Decidim
|
22
|
+
|
23
|
+
A single Decidim deploy can be used by multiple organizations (tenants) at the same time. All resources and entities are always scoped to an organization.
|
24
|
+
|
25
|
+
When using Decidim as multi-tenant, you should keep these in mind:
|
26
|
+
|
27
|
+
* All organizations share the same database.
|
28
|
+
* Each organization must have a different hostname.
|
29
|
+
* Users aren't shared between each organization (the same email can be registered in different organizations and it will be considered as different users).
|
30
|
+
* All configuration related to Decidim (`Decidim.config`) is shared between the organizations.
|
31
|
+
* Stylesheets aren't customizable per-tenant so UI styles (colors and other variables) are shared.
|
32
|
+
|
33
|
+
## Glossary
|
34
|
+
|
35
|
+
* **Organization**: Each of the tenants using a Decidim deploy.
|
36
|
+
* **System admin**: Users that can manage organizations in a Decidim deploy.
|
37
|
+
* **Admins**: Users that can manage a **single** organization in a Decidim deploy.
|
38
|
+
* **Participatory process admins**: Users that can manage a **single participatory process** in an organization in a Decidim deploy.
|
39
|
+
|
40
|
+
## Managing System admins
|
41
|
+
|
42
|
+
Currently Decidim doesn't provide a way to create the first System Admin in a new deployment. To do it, you should open a Rails console in your application and
|
43
|
+
create it:
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
Decidim::System::Admin.create!(
|
47
|
+
email: "your-email@example.org",
|
48
|
+
password: "your-safe-password",
|
49
|
+
password_confirmation: "your-safe-password"
|
50
|
+
)
|
22
51
|
```
|
23
52
|
|
24
|
-
|
25
|
-
|
53
|
+
Once you have created your first admin you can access the system dashboard at `https://your-decidim-deployment-host/system` and login with your newly created user.
|
54
|
+
From the system dashboard you can add new admins.
|
55
|
+
|
56
|
+
## Managing organizations
|
57
|
+
|
58
|
+
Once you have your system admin setup you can also start managing the organizations in your deploy. To do it, login at the system dashboard and create a new organization
|
59
|
+
following the form instructions. After creating it, a new admin user will be created and invited to start managing it.
|
60
|
+
|
61
|
+
Remember that System admins and regular Admins are completely different users (they don't even share the same database table), so you can't use your
|
62
|
+
system user to login in as an organization admin.
|
26
63
|
|
27
64
|
## License
|
28
65
|
The gem is available as open source under the terms of the [AGPLv3 License](https://opensource.org/licenses/AGPL-3.0).
|
@@ -42,7 +42,10 @@ module Decidim
|
|
42
42
|
Decidim::Organization.create!(
|
43
43
|
name: form.name,
|
44
44
|
host: form.host,
|
45
|
+
secondary_hosts: form.clean_secondary_hosts,
|
46
|
+
reference_prefix: form.reference_prefix,
|
45
47
|
available_locales: form.available_locales,
|
48
|
+
available_authorizations: form.clean_available_authorizations,
|
46
49
|
default_locale: form.default_locale
|
47
50
|
)
|
48
51
|
end
|
@@ -42,6 +42,8 @@ module Decidim
|
|
42
42
|
def save_organization
|
43
43
|
organization.name = form.name
|
44
44
|
organization.host = form.host
|
45
|
+
organization.secondary_hosts = form.clean_secondary_hosts
|
46
|
+
organization.available_authorizations = form.clean_available_authorizations
|
45
47
|
|
46
48
|
organization.save!
|
47
49
|
end
|
@@ -4,10 +4,12 @@ module Decidim
|
|
4
4
|
# The main application controller that inherits from Rails.
|
5
5
|
class ApplicationController < ActionController::Base
|
6
6
|
include FormFactory
|
7
|
+
include PayloadInfo
|
7
8
|
protect_from_forgery with: :exception, prepend: true
|
8
9
|
|
9
10
|
helper Decidim::TranslationsHelper
|
10
11
|
helper Decidim::DecidimFormHelper
|
12
|
+
helper Decidim::ReplaceButtonsHelper
|
11
13
|
end
|
12
14
|
end
|
13
15
|
end
|
@@ -12,6 +12,7 @@ module Decidim
|
|
12
12
|
attribute :organization_admin_name, String
|
13
13
|
attribute :available_locales, Array
|
14
14
|
attribute :default_locale, String
|
15
|
+
attribute :reference_prefix
|
15
16
|
|
16
17
|
validates :organization_admin_email, :organization_admin_name, :name, :host, presence: true
|
17
18
|
validates :available_locales, presence: true
|
@@ -12,9 +12,27 @@ module Decidim
|
|
12
12
|
|
13
13
|
attribute :name, String
|
14
14
|
attribute :host, String
|
15
|
+
attribute :secondary_hosts, String
|
16
|
+
attribute :available_authorizations, Array[String]
|
15
17
|
|
18
|
+
validates :name, presence: true
|
19
|
+
validates :host, presence: true
|
16
20
|
validate :validate_organization_uniqueness
|
17
21
|
|
22
|
+
def map_model(model)
|
23
|
+
self.secondary_hosts = model.secondary_hosts.join("\n")
|
24
|
+
end
|
25
|
+
|
26
|
+
def clean_secondary_hosts
|
27
|
+
return unless secondary_hosts
|
28
|
+
secondary_hosts.split("\n").map(&:chomp).select(&:present?)
|
29
|
+
end
|
30
|
+
|
31
|
+
def clean_available_authorizations
|
32
|
+
return unless available_authorizations
|
33
|
+
available_authorizations.select(&:present?)
|
34
|
+
end
|
35
|
+
|
18
36
|
private
|
19
37
|
|
20
38
|
def validate_organization_uniqueness
|
@@ -7,6 +7,16 @@
|
|
7
7
|
<%= f.text_field :host %>
|
8
8
|
</div>
|
9
9
|
|
10
|
+
<div class="field">
|
11
|
+
<%= f.text_area :secondary_hosts %>
|
12
|
+
<p class="help-text"><%= t(".secondary_hosts_hint") %></p>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="field">
|
16
|
+
<%= f.label :available_authorizations %>
|
17
|
+
<%= f.collection_check_boxes :available_authorizations, Decidim.authorization_handlers, :name, :name %>
|
18
|
+
</div>
|
19
|
+
|
10
20
|
<div class="actions">
|
11
21
|
<%= f.submit t("decidim.system.actions.save") %>
|
12
22
|
</div>
|
@@ -7,10 +7,19 @@
|
|
7
7
|
<%= f.text_field :name, autofocus: true %>
|
8
8
|
</div>
|
9
9
|
|
10
|
+
<div class="field">
|
11
|
+
<%= f.text_field :reference_prefix %>
|
12
|
+
</div>
|
13
|
+
|
10
14
|
<div class="field">
|
11
15
|
<%= f.text_field :host %>
|
12
16
|
</div>
|
13
17
|
|
18
|
+
<div class="field">
|
19
|
+
<%= f.text_area :secondary_hosts %>
|
20
|
+
<p class="help-text"><%= t(".secondary_hosts_hint") %></p>
|
21
|
+
</div>
|
22
|
+
|
14
23
|
<div class="field">
|
15
24
|
<%= f.text_field :organization_admin_name %>
|
16
25
|
</div>
|
@@ -20,29 +29,34 @@
|
|
20
29
|
</div>
|
21
30
|
|
22
31
|
<%= f.fields_for :locales do |fields| %>
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
<tr>
|
28
|
-
<td>Locale</td>
|
29
|
-
<td>Enabled <%= f.error_for(:available_locales) %></td>
|
30
|
-
<td>Default? <%= f.error_for(:default_locale) %></td>
|
31
|
-
</tr>
|
32
|
-
</thead>
|
33
|
-
<tbody>
|
34
|
-
<% localized_locales.each do |locale| %>
|
32
|
+
<div class="field">
|
33
|
+
<%= f.label :organization_locales, '', class: @form.respond_to?(:errors) && @form.errors[:default_locale].present? ? "is-invalid-label" : "" %>
|
34
|
+
<table>
|
35
|
+
<thead>
|
35
36
|
<tr>
|
36
|
-
<td
|
37
|
-
<td
|
38
|
-
<td
|
37
|
+
<td>Locale</td>
|
38
|
+
<td>Enabled <%= f.error_for(:available_locales) %></td>
|
39
|
+
<td>Default? <%= f.error_for(:default_locale) %></td>
|
39
40
|
</tr>
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
</thead>
|
42
|
+
<tbody>
|
43
|
+
<% localized_locales.each do |locale| %>
|
44
|
+
<tr>
|
45
|
+
<td><%= locale.name %></td>
|
46
|
+
<td><%= check_box_tag "organization[available_locales][#{locale.id}]", locale.id, @form.available_locales.include?(locale.id) %></td>
|
47
|
+
<td><%= radio_button_tag "organization[default_locale]", locale.id, @form.default_locale == locale.id %></td>
|
48
|
+
</tr>
|
49
|
+
<% end %>
|
50
|
+
</tbody>
|
51
|
+
</table>
|
52
|
+
</div>
|
44
53
|
<% end %>
|
45
54
|
|
55
|
+
<div class="field">
|
56
|
+
<%= f.label :available_authorizations %>
|
57
|
+
<%= f.collection_check_boxes :available_authorizations, Decidim.authorization_handlers, :name, :name %>
|
58
|
+
</div>
|
59
|
+
|
46
60
|
<div class="actions">
|
47
61
|
<%= f.submit t("decidim.system.models.organization.actions.save_and_invite") %>
|
48
62
|
</div>
|
data/config/locales/ca.yml
CHANGED
@@ -54,9 +54,12 @@ ca:
|
|
54
54
|
create:
|
55
55
|
error: S'ha produït un error en crear una nova organització.
|
56
56
|
success: L'organització s'ha creat correctament.
|
57
|
+
edit:
|
58
|
+
secondary_hosts_hint: Introdueix cada un d'ells en una nova línia
|
57
59
|
index:
|
58
60
|
title: Organitzacions
|
59
61
|
new:
|
62
|
+
secondary_hosts_hint: Introdueix cada un d'ells en una nova línia
|
60
63
|
title: Nova organització
|
61
64
|
update:
|
62
65
|
error: S'ha produït un error en actualitzar aquesta organització.
|
data/config/locales/en.yml
CHANGED
@@ -55,9 +55,12 @@ en:
|
|
55
55
|
create:
|
56
56
|
error: There was an error when creating a new organization.
|
57
57
|
success: Organization created successfully.
|
58
|
+
edit:
|
59
|
+
secondary_hosts_hint: Enter each one of them in a new line
|
58
60
|
index:
|
59
61
|
title: Organizations
|
60
62
|
new:
|
63
|
+
secondary_hosts_hint: Enter each one of them in a new line
|
61
64
|
title: New organization
|
62
65
|
update:
|
63
66
|
error: There was an error when updating this organization.
|
data/config/locales/es.yml
CHANGED
@@ -54,9 +54,12 @@ es:
|
|
54
54
|
create:
|
55
55
|
error: Se ha producido un error al crear una nueva organización.
|
56
56
|
success: Organización creada correctamente.
|
57
|
+
edit:
|
58
|
+
secondary_hosts_hint: Introduce cada uno de ellos en una nueva línea
|
57
59
|
index:
|
58
60
|
title: Organizaciones
|
59
61
|
new:
|
62
|
+
secondary_hosts_hint: Introduce cada uno de ellos en una nueva línea
|
60
63
|
title: Nueva organización
|
61
64
|
update:
|
62
65
|
error: Se ha producido un error al actualizar esta organización.
|
data/config/locales/eu.yml
CHANGED
@@ -0,0 +1,68 @@
|
|
1
|
+
fi:
|
2
|
+
decidim:
|
3
|
+
system:
|
4
|
+
actions:
|
5
|
+
confirm_destroy: Haluatko varmasti poistaa tämän?
|
6
|
+
destroy: Poista
|
7
|
+
edit: Muokkaa
|
8
|
+
new: Uusi %{name}
|
9
|
+
save: Tallenna
|
10
|
+
title: Toiminnot
|
11
|
+
admins:
|
12
|
+
create:
|
13
|
+
error: Uuden hallinnoijan luonnissa tapahtui virhe.
|
14
|
+
success: Hallinnoija luotu onnistuneesti
|
15
|
+
destroy:
|
16
|
+
success: Hallinnoija poistettu onnistuneesti
|
17
|
+
edit:
|
18
|
+
title: Muokkaa hallinnoijaa
|
19
|
+
update: Päivitä hallinnoija
|
20
|
+
index:
|
21
|
+
title: Hallinnoijat
|
22
|
+
new:
|
23
|
+
create: Luo hallinnoija
|
24
|
+
title: Uusi hallinnoija
|
25
|
+
update:
|
26
|
+
error: Hallinnoijan päivityksessä tapahtui virhe.
|
27
|
+
success: Hallinnoija päivitetty onnistuneesti
|
28
|
+
default_pages:
|
29
|
+
placeholders:
|
30
|
+
content: Lisää sisältöä tälle sivulle hallintapaneelista.
|
31
|
+
title: Oletusotsikko sivulle %{page}
|
32
|
+
menu:
|
33
|
+
admins: Hallinnoijat
|
34
|
+
dashboard: Hallintapaneeli
|
35
|
+
organizations: Organisaatiot
|
36
|
+
models:
|
37
|
+
admin:
|
38
|
+
fields:
|
39
|
+
created_at: Luotu
|
40
|
+
email: Sähköposti
|
41
|
+
name: Hallinnoija
|
42
|
+
validations:
|
43
|
+
email_uniqueness: toinen hallinnointikäyttäjä on jo olemassa samalla sähköpostilla
|
44
|
+
organization:
|
45
|
+
actions:
|
46
|
+
save_and_invite: Luo organisaatioita ja kutsu hallinnointikäyttäjiä
|
47
|
+
fields:
|
48
|
+
created_at: Luotu
|
49
|
+
name: Nimi
|
50
|
+
name: Organisaatio
|
51
|
+
page:
|
52
|
+
name: Sivu
|
53
|
+
organizations:
|
54
|
+
create:
|
55
|
+
error: Uuden organisaation luonnissa tapahtui virhe.
|
56
|
+
success: Organisaatio luotu onnistuneesti.
|
57
|
+
edit:
|
58
|
+
secondary_hosts_hint: Syötä jokainen niistä omalle rivilleen
|
59
|
+
index:
|
60
|
+
title: Organisaatiot
|
61
|
+
new:
|
62
|
+
secondary_hosts_hint: Syötä jokainen niistä omalle rivilleen
|
63
|
+
title: Uusi organisaatio
|
64
|
+
update:
|
65
|
+
error: Organisaation päivityksessä tapahtui virhe.
|
66
|
+
success: Organisaatio päivitetty onnistuneesti.
|
67
|
+
titles:
|
68
|
+
dashboard: Hallintapaneeli
|
data/db/seeds.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-system
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-03-24 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-core
|
@@ -18,34 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.0.
|
21
|
+
version: 0.0.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.0.
|
28
|
+
version: 0.0.6
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: rails
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 5.0.
|
36
|
-
- - ">="
|
37
|
-
- !ruby/object:Gem::Version
|
38
|
-
version: 5.0.0.1
|
35
|
+
version: 5.0.2
|
39
36
|
type: :runtime
|
40
37
|
prerelease: false
|
41
38
|
version_requirements: !ruby/object:Gem::Requirement
|
42
39
|
requirements:
|
43
40
|
- - "~>"
|
44
41
|
- !ruby/object:Gem::Version
|
45
|
-
version: 5.0.
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: 5.0.0.1
|
42
|
+
version: 5.0.2
|
49
43
|
- !ruby/object:Gem::Dependency
|
50
44
|
name: devise
|
51
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,14 +88,14 @@ dependencies:
|
|
94
88
|
requirements:
|
95
89
|
- - "~>"
|
96
90
|
- !ruby/object:Gem::Version
|
97
|
-
version: 1.7.
|
91
|
+
version: 1.7.1
|
98
92
|
type: :runtime
|
99
93
|
prerelease: false
|
100
94
|
version_requirements: !ruby/object:Gem::Requirement
|
101
95
|
requirements:
|
102
96
|
- - "~>"
|
103
97
|
- !ruby/object:Gem::Version
|
104
|
-
version: 1.7.
|
98
|
+
version: 1.7.1
|
105
99
|
- !ruby/object:Gem::Dependency
|
106
100
|
name: sassc-rails
|
107
101
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,14 +158,14 @@ dependencies:
|
|
164
158
|
requirements:
|
165
159
|
- - '='
|
166
160
|
- !ruby/object:Gem::Version
|
167
|
-
version: 0.0.
|
161
|
+
version: 0.0.6
|
168
162
|
type: :development
|
169
163
|
prerelease: false
|
170
164
|
version_requirements: !ruby/object:Gem::Requirement
|
171
165
|
requirements:
|
172
166
|
- - '='
|
173
167
|
- !ruby/object:Gem::Version
|
174
|
-
version: 0.0.
|
168
|
+
version: 0.0.6
|
175
169
|
description: System administration to create new organization in an installation.
|
176
170
|
email:
|
177
171
|
- josepjaume@gmail.com
|
@@ -238,6 +232,7 @@ files:
|
|
238
232
|
- config/locales/en.yml
|
239
233
|
- config/locales/es.yml
|
240
234
|
- config/locales/eu.yml
|
235
|
+
- config/locales/fi.yml
|
241
236
|
- config/routes.rb
|
242
237
|
- db/migrate/20160919105637_devise_create_decidim_admins.rb
|
243
238
|
- db/seeds.rb
|