znt/module/group/test/model/getrelatedprivs.php

32 lines
1.3 KiB
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env php
<?php
/**
title=测试 groupModel->getRelatedPrivs();
timeout=0
cid=16716
- 选中my-todo权限会提示依赖my和todo模块
- 第depend条的my属性 @my
- 第depend条的todo属性 @todo
- 选中my-todo权限会推荐todo模块的方法
- 第recommend条的my属性 @~~
- 第recommend条的todo属性 @todo
- 选中my-todo权限已选中推荐方法my-index那么my模块也会出现在推荐中
- 第depend条的my属性 @my
- 第depend条的todo属性 @todo
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
$group = new groupModelTest();
$allPrivs = array('my-index', 'my-calendar', 'my-todo', 'todo-view', 'todo-calendar');
r($group->getRelatedPrivsTest($allPrivs, array('my-todo'), array())) && p('depend:my,todo') && e('my,todo'); // 选中my-todo权限会提示依赖my和todo模块
r($group->getRelatedPrivsTest($allPrivs, array('my-todo'), array())) && p('recommend:my,todo') && e('~~,todo'); // 选中my-todo权限会推荐todo模块的方法
r($group->getRelatedPrivsTest($allPrivs, array('my-todo'), array('my-index'))) && p('depend:my,todo') && e('my,todo'); // 选中my-todo权限已选中推荐方法my-index那么my模块也会出现在推荐中