Create institution addUserAsStaff() and addUserAsAdmin() wrapper functions

Bug #1828309 reported by Robert Lyon on 2019-05-08
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Wishlist
Robert Lyon

Bug Description

We have an $institution->addUserAsMember() function that adds a user to an institution it would be good to make a couple of wrapper functions so that we can add them as institution staff or institution admin role during the add member process

Steven (stevens-q) wrote :

TITLE: Create institution addUserAsStaff() and addUserAsAdmin() wrapper functions

BUG SUMMARY: We have an $institution->addUserAsMember() function that adds a user to an institution it would be good to make a couple of wrapper functions so that we can add them as institution staff or institution admin role during the add member process

When we do something like:
$userid = 7;
$institution = 'test';

$user = new User();
$user->find_by_id($userid);

$institution = new Institution($institution);
$institution->addUserAsStaff($user);

==============================================

Commit hash: e168d22f5534d0e830ecbb535c096b4cbd1e6fdd
Environment tested: Master
Browser tested: Chrome
Theme used: N/A

1) The following users exist (userid 1- 21)
2) Add the following code to the index.php file found in the htdocs folder.
  a) Add the code just above the if user is logged in function (line 29)
  b) code to add is
  $userid = 7;
  $institution = 'mynewinstitution';

  $user = new User();
  $user->find_by_id($userid);

  $institution = new Institution($institution);
  $institution->addUserAsStaff($user);
3) Site admin user is Logged in to site

TEST STEPS:
------------------------
1) Browse to the home page (wait for page to load)
2) Browse to Admin menu > Institutions > Staff
4) Verify that Userid 7 has been added to the Institution staff ✔
5) Change the $userid = 7; in the code on the index.php to = 8
6) Browse to Admin menu > Institutions > Staff
7) Verify that Userid 8 has been added to the Institution staff ✔

Catalyst QA ✔

NOTE: Remove the code from the index.php file

Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/9985

Reviewed: https://reviews.mahara.org/9983
Committed: https://git.mahara.org/mahara/mahara/commit/e168d22f5534d0e830ecbb535c096b4cbd1e6fdd
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit e168d22f5534d0e830ecbb535c096b4cbd1e6fdd
Author: Robert Lyon <email address hidden>
Date: Thu May 9 10:25:57 2019 +1200

Bug 1828309: Allow adding members to an institution with admin/staff role

Via the addUserAsMember() function

By creating addUserAsStaff() and addUserAsAdmin() wrappers

behatnotneeded

Change-Id: Ie6c973377cb81e5aeb904b07103a324456796599
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9) on 2019-06-09
Changed in mahara:
status: In Progress → Fix Committed
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/9985
Committed: https://git.mahara.org/mahara/mahara/commit/5d825f94996938d7fd409e9a4fd91024b0c81c00
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 5d825f94996938d7fd409e9a4fd91024b0c81c00
Author: Robert Lyon <email address hidden>
Date: Thu May 9 11:52:41 2019 +1200

Bug 1828309: Adjust create_user() function

Allow it to add a user to an institution with either staff or admin
priveleges by default

behatnotneeded

Change-Id: I596b7edc730267210f4ff825a8fcb044606686a5
Signed-off-by: Robert Lyon <email address hidden>

tags: added: nominatedfeature
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers