Skip to content

Commit 60e83fd

Browse files
authored
remove generic group / perms code (#342)
1 parent 5f06872 commit 60e83fd

File tree

3 files changed

+0
-369
lines changed

3 files changed

+0
-369
lines changed

resources/lib/UnityPerms.php

Lines changed: 0 additions & 161 deletions
This file was deleted.

resources/lib/UnitySQL.php

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ class UnitySQL
1111
private const TABLE_PAGES = "pages";
1212
private const TABLE_AUDIT_LOG = "audit_log";
1313
private const TABLE_ACCOUNT_DELETION_REQUESTS = "account_deletion_requests";
14-
private const TABLE_GROUP_ROLES = "groupRoles";
15-
private const TABLE_GROUP_TYPES = "groupTypes";
16-
private const TABLE_GROUP_ROLE_ASSIGNMENTS = "groupRoleAssignments";
17-
private const TABLE_GROUP_REQUESTS = "groupRequests";
18-
private const TABLE_GROUP_JOIN_REQUESTS = "groupJoinRequests";
19-
2014
// FIXME this string should be changed to something more intuitive, requires production change
2115
public const REQUEST_BECOME_PI = "admin";
2216

@@ -339,72 +333,4 @@ public function deleteAccountDeletionRequest($uid)
339333
$stmt->bindParam(":uid", $uid);
340334
$stmt->execute();
341335
}
342-
343-
public function getRole($uid, $group)
344-
{
345-
$table = self::TABLE_GROUP_ROLE_ASSIGNMENTS;
346-
$stmt = $this->conn->prepare(
347-
"SELECT * FROM $table WHERE user=:uid AND `group`=:group",
348-
);
349-
$stmt->bindParam(":uid", $uid);
350-
$stmt->bindParam(":group", $group);
351-
352-
$stmt->execute();
353-
354-
return $stmt->fetchAll()[0]["role"];
355-
}
356-
357-
public function hasPerm($role, $perm)
358-
{
359-
$stmt = $this->conn->prepare(
360-
"SELECT * FROM " . self::TABLE_GROUP_ROLES . " WHERE slug=:role",
361-
);
362-
$stmt->bindParam(":role", $role);
363-
364-
$stmt->execute();
365-
366-
$row = $stmt->fetchAll()[0];
367-
$perms = explode(",", $row["perms"]);
368-
return in_array($perm, $perms);
369-
}
370-
371-
public function getPriority($role)
372-
{
373-
$stmt = $this->conn->prepare(
374-
"SELECT * FROM " . self::TABLE_GROUP_ROLES . " WHERE slug=:role",
375-
);
376-
$stmt->bindParam(":role", $role);
377-
378-
$stmt->execute();
379-
380-
$row = $stmt->fetchAll()[0];
381-
return $row["priority"];
382-
}
383-
384-
public function roleAvailableInGroup($uid, $group, $role)
385-
{
386-
$table = self::TABLE_GROUP_ROLE_ASSIGNMENTS;
387-
$stmt = $this->conn->prepare(
388-
"SELECT * FROM $table WHERE user=:uid AND `group`=:group",
389-
);
390-
$stmt->bindParam(":uid", $uid);
391-
$stmt->bindParam(":group", $group);
392-
393-
$stmt->execute();
394-
$row = $stmt->fetchAll()[0];
395-
396-
$group_slug = $row["group"];
397-
398-
$stmt = $this->conn->prepare(
399-
"SELECT * FROM " . self::TABLE_GROUP_TYPES . " WHERE slug=:slug",
400-
);
401-
402-
$stmt->bindParam(":slug", $group_slug);
403-
$stmt->execute();
404-
405-
$row = $stmt->fetchAll()[0];
406-
$roles = explode(",", $row["roles"]);
407-
408-
return in_array($role, $roles);
409-
}
410336
}

0 commit comments

Comments
 (0)