-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build access to programs by member roles Allow roles to have program enrollments. Members with the same role should have access to the enrollment program resources. This is similar to the enrollments via organization memberships. * Add migration for roles in program enrollments * Associate the member, enrollment and role models * Refactor dataset methods to also access role enrollments * Expose :roles in program enrollments entity * Implement admin pages for roles update Refactor how 'enrollee' are exposed and listed. Ensure that roles are reflected in programs and enrollments CRUD pages. --------- Co-authored-by: Rob Galanakis <[email protected]>
- Loading branch information
1 parent
7f0d640
commit 43f8205
Showing
20 changed files
with
281 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# frozen_string_literal: true | ||
|
||
require "sequel/unambiguous_constraint" | ||
|
||
Sequel.migration do | ||
up do | ||
alter_table(:program_enrollments) do | ||
add_foreign_key :role_id, :roles, on_delete: :cascade, index: true | ||
|
||
drop_constraint(:one_enrollee_set) | ||
add_constraint( | ||
:one_enrollee_set, | ||
Sequel.unambiguous_constraint([:member_id, :organization_id, :role_id]), | ||
) | ||
|
||
drop_index(:program_id, name: :unique_enrollee_in_program_idx) | ||
add_index [ | ||
Sequel.function(:coalesce, :member_id, 0), | ||
Sequel.function(:coalesce, :organization_id, 0), | ||
Sequel.function(:coalesce, :role_id, 0), | ||
:program_id, | ||
], | ||
name: :unique_enrollee_in_program_idx, | ||
unique: true | ||
end | ||
end | ||
|
||
down do | ||
alter_table(:program_enrollments) do | ||
drop_index(:program_id, name: :unique_enrollee_in_program_idx) | ||
add_index [ | ||
Sequel.function(:coalesce, :member_id, 0), | ||
Sequel.function(:coalesce, :organization_id, 0), | ||
:program_id, | ||
], | ||
name: :unique_enrollee_in_program_idx, | ||
unique: true | ||
|
||
drop_constraint(:one_enrollee_set) | ||
add_constraint( | ||
:one_enrollee_set, | ||
Sequel.unambiguous_constraint([:member_id, :organization_id]), | ||
) | ||
drop_column(:role_id) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.