Skip to content

Commit

Permalink
Merge pull request #142 from hitobito/feature/jubla-129-nejb-structure
Browse files Browse the repository at this point in the history
NEJB Structure
  • Loading branch information
kronn authored Oct 24, 2024
2 parents eac1ebf + 710fd37 commit d03d600
Show file tree
Hide file tree
Showing 17 changed files with 419 additions and 56 deletions.
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Additional features include member census, camps and course conditions.
# Jubla Organization Hierarchy

<!-- roles:start -->
* Organisation
* Organisation
* Administrator: 2FA [:layer_and_below_full, :admin]
* Bund
* Bund
* Adressverwaltung: [:group_full]
Expand Down Expand Up @@ -155,6 +158,54 @@ Additional features include member census, camps and course conditions.
* Mitglied: [:group_read]
* Extern: []
* Versandadresse: []
* NEJB
* NEJB
* Adressverwaltung: [:group_full]
* Versandadresse: []
* IT Support: [:admin, :impersonation]
* NEJB Bundesleitung
* Adressverwaltung: [:admin, :layer_and_below_full, :contact_data]
* Netzwerk Ehemalige Jungwacht Blauring
* Leitung: [:group_and_below_full, :contact_data]
* Adressverwaltung: [:group_and_below_full]
* Kassier*in: [:group_and_below_read]
* Aktivmitglied: [:group_read]
* Passivmitglied: [:group_read]
* Kollektivmitglied: [:group_read]
* Neumitglied: []
* Extern: []
* Versandadresse: []
* Kanton (Ehemalige)
* Kanton (Ehemalige)
* Adressverwaltung: [:admin, :layer_and_below_full, :contact_data]
* Kantonaler Ehemaligenverein
* Leitung: [:group_and_below_full, :contact_data]
* Adressverwaltung: [:group_and_below_full]
* Kassier*in: [:group_and_below_read]
* Mitglied Ehemalige: [:group_read]
* Neumitglied: []
* Extern: []
* Versandadresse: []
* Region (Ehemalige)
* Region (Ehemalige)
* Adressverwaltung: [:admin, :layer_and_below_full, :contact_data]
* Regionaler Ehemaligenverein
* Leitung: [:group_and_below_full, :contact_data]
* Adressverwaltung: [:group_and_below_full]
* Kassier*in: [:group_and_below_read]
* Mitglied Ehemalige: [:group_read]
* Neumitglied: []
* Extern: []
* Versandadresse: []
* Ehemaligenschar
* Ehemaligenschar
* Leitung: [:group_and_below_full, :contact_data]
* Adressverwaltung: [:group_and_below_full]
* Kassier*in: [:group_and_below_read]
* Mitglied Ehemalige: [:group_read]
* Neumitglied: []
* Extern: []
* Versandadresse: []
* Global
* Einfache Gruppe
* Leitung: [:group_full]
Expand Down
7 changes: 5 additions & 2 deletions app/domain/jubla/mailing_lists/subscribers.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

# Copyright (c) 2017-2021, Jungwacht Blauring Schweiz. This file is part of
# Copyright (c) 2017-2024, Jungwacht Blauring Schweiz. This file is part of
# hitobito and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito.
Expand All @@ -25,7 +25,10 @@ def excluded_subscriber_ids_with_preferences
end

def excluded_by_contact_preference
Person.alumnus_only.where("contactable_by_#{layer_type}": false).select(:id)
preference_column = "contactable_by_#{layer_type}"
return Person.none unless Person.column_names.include?(preference_column)

Person.alumnus_only.where("#{preference_column}": false).select(:id)
end

def layer_type
Expand Down
5 changes: 3 additions & 2 deletions app/domain/jubla/person/filter/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ def accessibles_with_excluded
def excluded_people_ids
layer_type = group.layer_group.type.demodulize.underscore

return [] if layer_type == "root"
preference_column = "contactable_by_#{layer_type}"
return Person.none unless Person.column_names.include?(preference_column)

Person.alumnus_only.where("contactable_by_#{layer_type}": false).pluck(:id)
Person.alumnus_only.where("#{preference_column}": false).pluck(:id)
end
end
40 changes: 40 additions & 0 deletions app/models/group/kanton_ehemaligenverein.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# frozen_string_literal: true

# Copyright (c) 2024-2024, Jungwacht Blauring Schweiz. This file is part of
# hitobito_jubla and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jubla.

class Group::KantonEhemaligenverein < ::Group
### ROLES

class Leader < ::Role
self.permissions = [:group_and_below_full, :contact_data]
end

class GroupAdmin < ::Role
self.permissions = [:group_and_below_full]
end

class Treasurer < ::Role
self.permissions = [:group_and_below_read]
end

class NejbMember < ::Role
self.permissions = [:group_read]
end

class NejbJoiner < ::Role
self.permissions = []
end

class External < ::Role
self.permissions = []
end

class DispatchAddress < ::Role
self.permissions = []
end

roles Leader, GroupAdmin, Treasurer, NejbMember, NejbJoiner, External, DispatchAddress
end
29 changes: 29 additions & 0 deletions app/models/group/nejb.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: true

# Copyright (c) 2024-2024, Jungwacht Blauring Schweiz. This file is part of
# hitobito_jubla and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jubla.

class Group::Nejb < ::Group
self.layer = true
children Group::NejbBundesleitung,
Group::NetzwerkEhemaligeJungwachtBlauring,
Group::NejbKanton

### ROLES

class GroupAdmin < ::Role
self.permissions = [:group_full]
end

class DispatchAddress < ::Role
self.permissions = []
end

class ITSupport < ::Role
self.permissions = [:admin, :impersonation]
end

roles GroupAdmin, DispatchAddress, ITSupport
end
14 changes: 14 additions & 0 deletions app/models/group/nejb_bundesleitung.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# frozen_string_literal: true

# Copyright (c) 2024-2024, Jungwacht Blauring Schweiz. This file is part of
# hitobito_jubla and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jubla.

class Group::NejbBundesleitung < ::Group
class GroupAdmin < ::Role
self.permissions = [:admin, :layer_and_below_full, :contact_data]
end

roles GroupAdmin
end
17 changes: 17 additions & 0 deletions app/models/group/nejb_kanton.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

# Copyright (c) 2024-2024, Jungwacht Blauring Schweiz. This file is part of
# hitobito_jubla and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jubla.

class Group::NejbKanton < ::Group
children Group::KantonEhemaligenverein, Group::NejbRegion
self.layer = true

class GroupAdmin < ::Role
self.permissions = [:admin, :layer_and_below_full, :contact_data]
end

roles GroupAdmin
end
17 changes: 17 additions & 0 deletions app/models/group/nejb_region.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

# Copyright (c) 2024, Jungwacht Blauring Schweiz. This file is part of
# hitobito_jubla and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jubla.

class Group::NejbRegion < ::Group
children Group::RegionEhemaligenverein, Group::NejbSchar
self.layer = true

class GroupAdmin < ::Role
self.permissions = [:admin, :layer_and_below_full, :contact_data]
end

roles GroupAdmin
end
42 changes: 42 additions & 0 deletions app/models/group/nejb_schar.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# frozen_string_literal: true

# Copyright (c) 2024-2024, Jungwacht Blauring Schweiz. This file is part of
# hitobito_jubla and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jubla.

class Group::NejbSchar < ::Group
self.layer = true

### ROLES

class Leader < ::Role
self.permissions = [:group_and_below_full, :contact_data]
end

class GroupAdmin < ::Role
self.permissions = [:group_and_below_full]
end

class Treasurer < ::Role
self.permissions = [:group_and_below_read]
end

class NejbMember < ::Role
self.permissions = [:group_read]
end

class NejbJoiner < ::Role
self.permissions = []
end

class External < ::Role
self.permissions = []
end

class DispatchAddress < ::Role
self.permissions = []
end

roles Leader, GroupAdmin, Treasurer, NejbMember, NejbJoiner, External, DispatchAddress
end
48 changes: 48 additions & 0 deletions app/models/group/netzwerk_ehemalige_jungwacht_blauring.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

# Copyright (c) 2024-2024, Jungwacht Blauring Schweiz. This file is part of
# hitobito_jubla and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jubla.

class Group::NetzwerkEhemaligeJungwachtBlauring < ::Group
### ROLES

class Leader < ::Role
self.permissions = [:group_and_below_full, :contact_data]
end

class GroupAdmin < ::Role
self.permissions = [:group_and_below_full]
end

class Treasurer < ::Role
self.permissions = [:group_and_below_read]
end

class ActiveMember < ::Role
self.permissions = [:group_read]
end

class PassiveMember < ::Role
self.permissions = [:group_read]
end

class CollectiveMember < ::Role
self.permissions = [:group_read]
end

class NejbJoiner < ::Role
self.permissions = []
end

class External < ::Role
self.permissions = []
end

class DispatchAddress < ::Role
self.permissions = []
end

roles Leader, GroupAdmin, Treasurer, ActiveMember, PassiveMember, CollectiveMember, NejbJoiner, External, DispatchAddress
end
40 changes: 40 additions & 0 deletions app/models/group/region_ehemaligenverein.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# frozen_string_literal: true

# Copyright (c) 2024, Jungwacht Blauring Schweiz. This file is part of
# hitobito_jubla and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jubla.

class Group::RegionEhemaligenverein < ::Group
### ROLES

class Leader < ::Role
self.permissions = [:group_and_below_full, :contact_data]
end

class GroupAdmin < ::Role
self.permissions = [:group_and_below_full]
end

class Treasurer < ::Role
self.permissions = [:group_and_below_read]
end

class NejbMember < ::Role
self.permissions = [:group_read]
end

class NejbJoiner < ::Role
self.permissions = []
end

class External < ::Role
self.permissions = []
end

class DispatchAddress < ::Role
self.permissions = []
end

roles Leader, GroupAdmin, Treasurer, NejbMember, NejbJoiner, External, DispatchAddress
end
2 changes: 1 addition & 1 deletion app/models/group/root.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ def alumnus_manager

roles Admin

children Group::Federation
children Group::Federation, Group::Nejb
end
4 changes: 2 additions & 2 deletions app/models/jubla/group.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2012-2017, Jungwacht Blauring Schweiz. This file is part of
# Copyright (c) 2012-2024, Jungwacht Blauring Schweiz. This file is part of
# hitobito_jubla and licensed under the Affero General Public License version 3
# or later. See the COPYING file at the top-level directory or at
# https://github.com/hitobito/hitobito_jubla.
Expand Down Expand Up @@ -34,7 +34,7 @@ module Jubla::Group
# define global children
children Group::SimpleGroup

root_types Group::Federation
root_types Group::Root, Group::Federation, Group::Nejb

private

Expand Down
Loading

0 comments on commit d03d600

Please sign in to comment.