diff options
author | Minteck <nekostarfan@gmail.com> | 2021-08-08 22:31:51 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-08-08 22:31:51 +0200 |
commit | 94c57fa247ba107fce8fc1d1fc355191229dbddc (patch) | |
tree | 865048aa574ef63ad322ed8e5057eb7629e03c29 /admin/callback | |
parent | e255736e3f2a95ee82cadc01b0c70749ab946226 (diff) | |
download | main-94c57fa247ba107fce8fc1d1fc355191229dbddc.tar.gz main-94c57fa247ba107fce8fc1d1fc355191229dbddc.tar.bz2 main-94c57fa247ba107fce8fc1d1fc355191229dbddc.zip |
Permissions system
Diffstat (limited to 'admin/callback')
-rw-r--r-- | admin/callback/index.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/admin/callback/index.php b/admin/callback/index.php index 8816c32..5052369 100644 --- a/admin/callback/index.php +++ b/admin/callback/index.php @@ -36,7 +36,14 @@ if (isset($result["access_token"])) { $result = curl_exec($crl);
$result = json_decode($result, true);
- if ($result["id"] === "74bca7d2-4694-477c-8bc1-9003315abbee") {
+ $login = false;
+ foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/permissions.json"), true) as $id => $user) {
+ if ($result["id"] === $id && in_array("login", $user)) {
+ $login = true;
+ }
+ }
+
+ if ($login) {
$token = bin2hex(random_bytes(32));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/tokens/" . $token, json_encode($result));
setcookie("ADMIN_TOKEN", $token, 0, "/", ".minteck.ro.lt", true, true);
|