22 lines
679 B
PHP
22 lines
679 B
PHP
<?php
|
|
|
|
require_once "globals.php";
|
|
require_once "common_func.php";
|
|
|
|
require_once "usermgr.php";
|
|
require_once "groupmgr.php";
|
|
require_once "gamemgr.php";
|
|
|
|
function does_user_access_game($nickname, $gameid): bool {
|
|
// get game and user data
|
|
$game_data = get_game($gameid);
|
|
$user_data = get_user($nickname);
|
|
if ((count($game_data) === 0) || (count($user_data) === 0)) {
|
|
return false;
|
|
}
|
|
|
|
// check if this user has permission to take this test
|
|
// if the intersection of user's groups and game's assigned groups is zero, then the user has no access to this game
|
|
return count(array_intersect($game_data["groups"], $user_data["groups"])) !== 0;
|
|
}
|