| @@ -445,8 +445,14 @@ | ||
| 445 | 445 | * @param string $context Authentication context |
| 446 | 446 | * @return bool True if user has access, false otherwise |
| 447 | 447 | */ |
| 448 | 448 | public static function user_has_access($user_id, $context = 'default') { |
| 449 | + $user_id = absint($user_id); | |
| 450 | + if (!$user_id) { | |
| 451 | + return false; | |
| 452 | + } | |
| 453 | + | |
| 449 | 454 | $auth = new self($context); |
| 455 | + $auth->user_id = $user_id; | |
| 450 | 456 | return $auth->has_access(); |
| 451 | 457 | } |
| 452 | 458 | } |