Files
EasySoft-ZenTaoPMS/test/model/user/authorize.php
2022-03-17 13:40:02 +08:00

25 lines
914 B
PHP
Executable File

#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
su('admin');
/**
title=userModel->authorizeTest();
cid=1
pid=1
获取用户的权限,返回权限列表 >> 1
获取用户的权限,返回权限列表 >> 1
获取空用户名的权限,返回空 >> 0
*/
$user = new userTest();
$rights = $user->authorizeTest('test2');
r($rights['rights']) && p('action:comment') && e('1'); //获取用户的权限,返回权限列表
r($rights['rights']) && p('testtask:activate') && e('1'); //获取用户的权限,返回权限列表
r($user->authorizeTest('sadf!!@#a')) && p('projects') && e(''); //获取不存在的用户的权限,返回空
r($user->authorizeTest('')) && p('') && e('0'); //获取空用户名的权限,返回空