1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- namespace Cas\Dao;
- use KIF\Dao\DBAgileDev;
- /**
- *
- * kif权限管理系统 - 用户组权限管理
- * @author lishumingoo@gmail.com
- */
- class KifUsergroupPermission extends DBAgileDev {
- protected $tableName = 'kif_usergroup_permission';
-
- /**
- * 数据库里的真实字段
- * @var array
- */
- protected $other_field = array(
- 'groupid',
- 'resourceid',
- );
-
- public function __construct($master_flag = 'backend') {
- parent::__construct($master_flag);
- }
-
- /**
- * 获取多用户组权限配置
- * @param array $groupids
- * @return array
- */
- public function getsCompetencesByGroupids($groupids) {
- if (!$groupids) {
- return array();
- }
-
- $ids = $this->findIdsBy(array(
- 'groupid' => $groupids
- ));
-
- $competences = $this->gets($ids);
- if (!$competences) {
- return array();
- }
-
- $resourceids = array();
- foreach ($competences as $tmpCompetence) {
- $resourceids[] = $tmpCompetence['resourceid'];
- }
-
- $objKifResourceManage = new KifResourceManage();
- $resources = $objKifResourceManage->gets($resourceids);
-
- foreach ($competences as $tmpKey => $tmpCompetence) {
- $resourceid = $tmpCompetence['resourceid'];
- $resource = $resources[$resourceid];
- $competences[$tmpKey]['app_name'] = $resource['app_name'];
- $competences[$tmpKey]['control_name'] = $resource['control_name'];
- $competences[$tmpKey]['action_name'] = $resource['action_name'];
- }
-
- return $competences;
- }
- }
|