Veno-File-Manager (VFM4)免数据库云盘系统,根目录/vfm-admin/class/class.gatekeeper.php文件释义
主目录/vfm-admin/class/class.gatekeeper.php //与用户权限相关的类
gatekeeper类的成员函数
isLoginRequired()
检查游客查看列表是否需要登录,游客“您需要登录才可以查看”是否开启
- /**
- * Check if login is required to view lists //检查查看列表是否需要登录
- *
- * @return true/false
- */
- public static function isLoginRequired()
- {
- global $setUp;
- if ($setUp->getConfig('require_login') == false) {
- return false;
- }
- return true;
- }
复制代码
isUserLoggedIn()
检查用户是否已登录
- /**
- * Check if user is logged in //检查用户是否已登录
- *
- * @return true/false
- */
- public static function isUserLoggedIn()
- {
- if (isset($_SESSION['vfm_user_name'])
- && isset($_SESSION['vfm_logged_in'])
- && $_SESSION['vfm_logged_in'] == 1
- ) {
- return true;
- }
- return false;
- }
复制代码
isAccessAllowed()
检查用户是否可以访问如果游客“您需要登录才可以查看”没有启用,或者用户已登录,返回真,否则为假。
- /**
- * Check if user can access //检查用户是否可以访问
- *
- * @return true/false
- */
- public function isAccessAllowed()
- {
- if (!$this->isLoginRequired() || $this->isUserLoggedIn()) {
- return true;
- }
- return false;
- }
复制代码 isAllowed()
检查是否允许目标操作
- /**
- * Check if target action is allowed //检查是否允许目标操作
- *
- * @param string $action action to check
- *
- * @return true/false
- */
- public function isAllowed($action)
- {
- global $setUp;
- if ($action && $this->isAccessAllowed()) {
- $role = $this->getUserInfo('role');
- $role = $role == null ? 'guest' : $role;
- if ($role == 'superadmin') {
- return true;
- }
- $base_actions = array(
- 'view_enable',
- 'viewdirs_enable',
- 'download_enable',
- );
- // Base actions true for all except Guest and User //基本操作对除来宾和用户外的所有操作均为真
- if (in_array($action, $base_actions) && $role !== 'guest' && $role !== 'user') {
- return true;
- }
- $role_ext = $role == 'admin' ? '' : '_'.$role;
- return $setUp->getConfig($action.$role_ext);
- }
- return false;
- }
复制代码
|
|