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

Program manager permission #20803

Merged
merged 18 commits into from Feb 28, 2018
Merged

Conversation

clareconstantine
Copy link

@clareconstantine clareconstantine commented Feb 21, 2018

Add a program_manager permission that has the same abilities as workshop_organizer

This PR creates the permission, and when a user becomes a program manager, they receive the permission. When their last RegionalPartnerProgramManager is destroyed, the permission is removed.

This PR also updates the backend and one pegasus helper to check for program_manager everywhere we check for workshop_organizer.

@clareconstantine clareconstantine requested review from mehalshah and removed request for mehalshah February 21, 2018 21:56
@clareconstantine clareconstantine force-pushed the program-manager-permission branch 2 times, most recently from 0eb67c2 to c22d638 Compare February 27, 2018 17:26
Copy link
Contributor

@mehalshah mehalshah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Offline discussion about changes to the workshop dashboard - please include those here as well

@@ -74,7 +74,7 @@ def assign_program_manager

# GET /regional_partners/:id/remove_program_manager
def remove_program_manager
@regional_partner.program_managers.delete(params[:program_manager_id])
@regional_partner.program_managers.destroy(params[:program_manager_id])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ick! Why were we deleting instead of destroying here any way?

@@ -17,4 +17,14 @@ class RegionalPartnerProgramManager < ActiveRecord::Base
belongs_to :regional_partner

has_many :pd_workshops_organized, class_name: 'Pd::Workshop', through: :program_manager

after_create do
program_manager.permission = 'program_manager'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the UserPremission::PROGRAM_MANAGER constant


after_destroy do
if program_manager.regional_partners.empty?
program_manager.delete_permission 'program_manager'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Contributor

@mehalshah mehalshah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One test to augment, then this LGTM

@@ -16,6 +16,7 @@ describe("Permission class", () => {
expect(permission.isWorkshopAdmin).to.be.true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should augment workshop_indexTest.js as well

@clareconstantine clareconstantine merged commit 09030a8 into staging Feb 28, 2018
@clareconstantine clareconstantine deleted the program-manager-permission branch June 6, 2018 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants