KifUsergroupPermission.class.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Cas\Dao;
  3. use KIF\Dao\DBAgileDev;
  4. /**
  5. *
  6. * kif权限管理系统 - 用户组权限管理
  7. * @author lishumingoo@gmail.com
  8. */
  9. class KifUsergroupPermission extends DBAgileDev {
  10. protected $tableName = 'kif_usergroup_permission';
  11. /**
  12. * 数据库里的真实字段
  13. * @var array
  14. */
  15. protected $other_field = array(
  16. 'groupid',
  17. 'resourceid',
  18. );
  19. public function __construct($master_flag = 'backend') {
  20. parent::__construct($master_flag);
  21. }
  22. /**
  23. * 获取多用户组权限配置
  24. * @param array $groupids
  25. * @return array
  26. */
  27. public function getsCompetencesByGroupids($groupids) {
  28. if (!$groupids) {
  29. return array();
  30. }
  31. $ids = $this->findIdsBy(array(
  32. 'groupid' => $groupids
  33. ));
  34. $competences = $this->gets($ids);
  35. if (!$competences) {
  36. return array();
  37. }
  38. $resourceids = array();
  39. foreach ($competences as $tmpCompetence) {
  40. $resourceids[] = $tmpCompetence['resourceid'];
  41. }
  42. $objKifResourceManage = new KifResourceManage();
  43. $resources = $objKifResourceManage->gets($resourceids);
  44. foreach ($competences as $tmpKey => $tmpCompetence) {
  45. $resourceid = $tmpCompetence['resourceid'];
  46. $resource = $resources[$resourceid];
  47. $competences[$tmpKey]['app_name'] = $resource['app_name'];
  48. $competences[$tmpKey]['control_name'] = $resource['control_name'];
  49. $competences[$tmpKey]['action_name'] = $resource['action_name'];
  50. }
  51. return $competences;
  52. }
  53. }