From b4ab8a4d760542d9190b20d920a926fb8f6818f7 Mon Sep 17 00:00:00 2001 From: Ryan Rathsam Date: Thu, 2 May 2019 14:29:20 -0400 Subject: [PATCH 1/2] Update `isRealmEnabled` sql The previous SQL statement answered the question, Is there a $realm that has been installed. This updated version answers the question, Is there an acl that grants access to this realm. This corresponds w/ having an entry in `roles.json##query_descripters` w/ a `realm` property = $realm, that is both enabled and visible. --- classes/OpenXdmod/DataWarehouseInitializer.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/classes/OpenXdmod/DataWarehouseInitializer.php b/classes/OpenXdmod/DataWarehouseInitializer.php index f9651ca5db..8027341204 100644 --- a/classes/OpenXdmod/DataWarehouseInitializer.php +++ b/classes/OpenXdmod/DataWarehouseInitializer.php @@ -416,7 +416,19 @@ public function aggregate( */ public function isRealmEnabled($realm) { - $realms = $this->warehouseDb->query("SELECT * FROM moddb.realms WHERE display = :realm", [':realm' => $realm]); + $sql = << $realm + ); + $realms = $this->warehouseDb->query($sql, $params); return (count($realms) > 0); } } From dc2e0841f6696867f12ad6f7d27323f15d8bfd06 Mon Sep 17 00:00:00 2001 From: Ryan Rathsam Date: Thu, 2 May 2019 14:44:13 -0400 Subject: [PATCH 2/2] Updated isRealmEnabled docblock --- classes/OpenXdmod/DataWarehouseInitializer.php | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/OpenXdmod/DataWarehouseInitializer.php b/classes/OpenXdmod/DataWarehouseInitializer.php index 8027341204..f633759912 100644 --- a/classes/OpenXdmod/DataWarehouseInitializer.php +++ b/classes/OpenXdmod/DataWarehouseInitializer.php @@ -413,6 +413,7 @@ 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) {