-
Notifications
You must be signed in to change notification settings - Fork 175
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
[user] Add getSites functions in User class #9102
Changes from 4 commits
43e4c23
8a12485
c0a2083
8be0013
1fd754a
c40c2e7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,17 @@ class UserAccountRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisione | |
*/ | ||
function __construct() | ||
{ | ||
// Get user | ||
$factory = \NDB_Factory::singleton(); | ||
$user = $factory->user(); | ||
if (!$user->hasPermission('user_accounts_multisite')) { | ||
$siteLimitQuery = "LEFT JOIN user_psc_rel upsr2 | ||
ON (upsr2.CenterID=upsr.CenterID) | ||
WHERE upsr2.UserID=:uid"; | ||
$params = ['uid' => $user->getId()]; | ||
} else { | ||
$params = []; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand why this is necessary. user_accounts.class.inc already has:
so shouldn't the HasAnyPermissionOrUserSiteMatch filter take care of it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. allSitePermissionNames function takes care of filtering out users who don't belong to one of the user's sites, but this code makes it so that only the user's sites are shown in the "Site" column of the table. With the change from user_accounts.class.inc but without this change, there were empty strings in between commas: |
||
parent::__construct( | ||
"SELECT GROUP_CONCAT(DISTINCT upsr.CenterID) as centerIds, | ||
GROUP_CONCAT(DISTINCT uprr.ProjectID) as projectIds, | ||
|
@@ -29,9 +40,10 @@ class UserAccountRowProvisioner extends \LORIS\Data\Provisioners\DBRowProvisione | |
FROM users u | ||
LEFT JOIN user_psc_rel upsr ON (upsr.UserID=u.ID) | ||
LEFT JOIN user_project_rel uprr ON (uprr.UserID=u.ID) | ||
$siteLimitQuery | ||
GROUP BY u.ID | ||
ORDER BY u.UserID", | ||
[] | ||
$params | ||
); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you should be using
$user->getStudySites()
instead of reimplementing the logicThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeffersoncasimir getStudySites only includes study sites, but I believe in this case we want all sites that the user has access to