userspermission.table.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * [WeEngine System] Copyright (c) 2014 WE7.CC
  4. * WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
  5. */
  6. defined('IN_IA') or exit('Access Denied');
  7. class UserspermissionTable extends We7Table {
  8. protected $tableName = 'users_permission';
  9. protected $primaryKey = 'id';
  10. protected $field = array('id', 'uniacid', 'uid', 'type', 'permission', 'url');
  11. public function userPermissionInfo($uid, $uniacid, $type = '') {
  12. $condition = array('uid' => $uid, 'uniacid' => $uniacid);
  13. if (!empty($type)) {
  14. $condition['type'] = $type;
  15. }
  16. return $this->query->from('users_permission')->where($condition)->get();
  17. }
  18. public function userModulesPermission($uid, $uniacid) {
  19. $condition = array(
  20. 'uid'=> $uid,
  21. 'uniacid' => $uniacid,
  22. 'type !=' => array(PERMISSION_ACCOUNT, PERMISSION_WXAPP),
  23. );
  24. return $this->query->from('users_permission')->where($condition)->getall('type');
  25. }
  26. public function userPermission($uid, $uniacid) {
  27. return $this->query->from('users_permission')->where('uid', $uid)->where('uniacid', $uniacid)->getall('type');
  28. }
  29. public function moduleClerkPermission($module) {
  30. global $_W;
  31. return $this->query->from('users_permission', 'p')->leftjoin('uni_account_users', 'u')->on(array('u.uid' => 'p.uid', 'u.uniacid' => 'p.uniacid'))->where('u.role', 'clerk')->where('p.type', $module)->where('u.uniacid', $_W['uniacid'])->getall('uid');
  32. }
  33. }