Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EVENTS: Kursart mit Flag 'Von Sektion erstellbar' #1151

Open
5 tasks
codez opened this issue Oct 18, 2024 · 0 comments
Open
5 tasks

EVENTS: Kursart mit Flag 'Von Sektion erstellbar' #1151

codez opened this issue Oct 18, 2024 · 0 comments

Comments

@codez
Copy link
Contributor

codez commented Oct 18, 2024

Als Mitgliederverwalter:in mit Schreibrechten einer Sektion möchte ich Externe Ausbildungen nur mit bestimmten Kursarten erstellen können.

Neu soll auf der Kursart ein Flag "Von Sektion erstellbar"/section_may_create hinzugefügt werden (Boolean, not null, default false). Dieses wird im Formular unterhalb "Unterkunft" als Checkbox dargestellt.

Bei der ExternalTrainingAbility wird für alle Permissions je eine neue Constraint Methode erstellt. Diese basiert auf den aktuell verwendeten Methoden und erhält den Suffix _if_section_may_create. Die Implementation prüft zusätzlich, ob die Berechtigungen entweder auf dem Root Layer vorhanden ist oder falls nicht, ob die zugehörige Kursart das Flag "Von Sektion erstellbar" gesetzt hat.

Beispiel für group_full / in_same_group:

def in_same_group_if_section_may_create
  in_same_group && permission_on_root_or_section_may_create(:group_full)
end

def permisson_on_root_or_section_may_create(permission)
  permitted_groups = user.groups_with_permission(permission)
  user_context.layer_ids(permitted_groups).include?(Group.root.id) ||
    subject.event_kind.section_may_create?
end

ToDo

  • Migration erstellen
  • Domainklasse anpassen
  • Model/View/Controller anpassen
  • Specs schreiben
  • Mit angemessener Rolle "durchklicken"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant