Skip to content

rename confusing constant #158

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
13 changes: 7 additions & 6 deletions resources/lib/UnitySQL.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class UnitySQL
private const TABLE_GROUP_JOIN_REQUESTS = "groupJoinRequests";


private const REQUEST_ADMIN = "admin";
// FIXME this string should be changed to something more intuitive, requires production sql change
private const REQUEST_BECOME_PI = "admin";

private $conn;

Expand All @@ -39,7 +40,7 @@ public function getConn()
//
// requests table methods
//
public function addRequest($requestor, $dest = self::REQUEST_ADMIN)
public function addRequest($requestor, $dest = self::REQUEST_BECOME_PI)
{
if ($this->requestExists($requestor, $dest)) {
return;
Expand All @@ -54,7 +55,7 @@ public function addRequest($requestor, $dest = self::REQUEST_ADMIN)
$stmt->execute();
}

public function removeRequest($requestor, $dest = self::REQUEST_ADMIN)
public function removeRequest($requestor, $dest = self::REQUEST_BECOME_PI)
{
if (!$this->requestExists($requestor, $dest)) {
return;
Expand All @@ -69,7 +70,7 @@ public function removeRequest($requestor, $dest = self::REQUEST_ADMIN)
$stmt->execute();
}

public function removeRequests($dest = self::REQUEST_ADMIN)
public function removeRequests($dest = self::REQUEST_BECOME_PI)
{
$stmt = $this->conn->prepare(
"DELETE FROM " . self::TABLE_REQS . " WHERE request_for=:request_for"
Expand All @@ -79,7 +80,7 @@ public function removeRequests($dest = self::REQUEST_ADMIN)
$stmt->execute();
}

public function requestExists($requestor, $dest = self::REQUEST_ADMIN)
public function requestExists($requestor, $dest = self::REQUEST_BECOME_PI)
{
$stmt = $this->conn->prepare(
"SELECT * FROM " . self::TABLE_REQS . " WHERE uid=:uid and request_for=:request_for"
Expand All @@ -92,7 +93,7 @@ public function requestExists($requestor, $dest = self::REQUEST_ADMIN)
return count($stmt->fetchAll()) > 0;
}

public function getRequests($dest = self::REQUEST_ADMIN)
public function getRequests($dest = self::REQUEST_BECOME_PI)
{
$stmt = $this->conn->prepare(
"SELECT * FROM " . self::TABLE_REQS . " WHERE request_for=:request_for"
Expand Down
1 change: 1 addition & 0 deletions webroot/panel/groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

$req_filtered = array();
foreach ($requests as $request) {
// FIXME "admin" -> UnitySQL::REQUEST_BECOME_PI
if ($request["request_for"] != "admin") { // put this in config later for gypsum
array_push($req_filtered, $request);
}
Expand Down
Loading