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

Update isRealmEnabled sql #912

Merged
merged 2 commits into from
May 2, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion classes/OpenXdmod/DataWarehouseInitializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,23 @@ public function aggregate(
* Check to see if a realm exists in the realms table
*
* @param string $realm The realm you are checking to see if exists
* @return bool
*/
public function isRealmEnabled($realm)
{
$realms = $this->warehouseDb->query("SELECT * FROM moddb.realms WHERE display = :realm", [':realm' => $realm]);
$sql = <<<SQL
SELECT 1
FROM moddb.acl_group_bys agb
JOIN moddb.realms r on agb.realm_id = r.realm_id
WHERE r.display = :realm AND
agb.enabled = TRUE AND
agb.visible = TRUE
LIMIT 1;
SQL;
$params = array(
':realm' => $realm
);
$realms = $this->warehouseDb->query($sql, $params);
return (count($realms) > 0);
}
}