federator/php/data/user.php

40 lines
841 B
PHP

<?php
/**
* SPDX-FileCopyrightText: 2024 Sascha Nitsch (grumpydeveloper) https://contentnation.net/@grumpydevelop
* SPDX-License-Identifier: GPL-3.0-or-later
*
* @author Sascha Nitsch (grumpydeveloper)
**/
namespace Federator\Data;
/**
* storage class for user attributes
*/
class User
{
/** @var string user id */
public $id;
/* @var string user language */
//public $lang;
/** @var array<string> user permissions */
public $permissions = [];
/** @var string session id */
public $session;
/**
* check if use has asked permission
* @param string $p @unused-param
* permission to check
*
* @return bool true if user has permission, false if not
*/
public function hasPermission(string $p)
{
return in_array($p, $this->permissions);
}
}