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

3.1.x new #498

Merged
merged 1 commit into from
Dec 23, 2014
Merged

3.1.x new #498

merged 1 commit into from
Dec 23, 2014

Conversation

tbae604
Copy link
Contributor

@tbae604 tbae604 commented Dec 13, 2014

v1_controller accounts for different role permissions in Connect and iPeer during add/update of user in iPeer

// if (ipeer) id does exist
if ($person['id']) {
// Queries role_id saved in iPeer
$role = $this->RolesUser->find('first', array('conditions' => array('user_id' => $person['id']), 'fields' => 'role_id'));
Copy link
Member

Choose a reason for hiding this comment

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

Could you merge this query with the query above to reduce the number of queries to the database. With large number of enrolment, it can be very slow.

@xcompass
Copy link
Member

I think the rest is good. Maybe squash the commits into one? What do you think about this pull request @ionparticle ?

@ionparticle
Copy link
Member

Ok, looks fine to me too. Ideally, I'd like all the changes in v1_controller to be one commit and all the new test cases to be another commit, but squashing them all into one is fine too.

@ionparticle
Copy link
Member

Would be great too if you add bullet point details to the commit messages like in #499

@tbae604
Copy link
Contributor Author

tbae604 commented Dec 22, 2014

Hi @xcompass, what do you think if I rewrite the multiple users import block to:

  • Generate a list of user ids from external decode (only for those whose ids are set)
  • Query saved role_ids at once for those users. Ideally there is a function for this part already.

Thank you, @ionparticle, I will adjust the commits and messages.

@xcompass
Copy link
Member

@tkbaylis, or you probably can do it in one query.e.g., extract all usernames in the decode, query database by usernames and returning the ids and roles (using contain).

This fixes, for example, iPeer superadmins who enter through external LMS where they are instructors and lose superadmin privileges at login.  Now, highest level (lowest role_id) is preserved.

- v1_controller compares external id to ipeer id (if saved) and chooses lower
- new users created in test cases for this functionality:
  - same external vs ipeer role_id
  - external role_id higher than saved in ipeer
  - external role_id lower than saved in ipeer
@tbae604
Copy link
Contributor Author

tbae604 commented Dec 23, 2014

I've decreased the number of queries, squashed all commits into one, and added comments.

xcompass added a commit that referenced this pull request Dec 23, 2014
Add/update users picks lowest role_id
@xcompass xcompass merged commit 0c86f09 into ubc:3.1.x Dec 23, 2014
@xcompass
Copy link
Member

Looks good. Thanks 👍

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.

3 participants