Comment 2 for bug 1828309

Revision history for this message
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