function perm_data() { $permissions = permissions_list(); $perm_parr = array(); foreach ($permissions as $row) { $perm_parr[$row->parent_id][] = $row; } $roleid = intval($this->input->post('roleid')); $this->load->library('Member_acl'); $my_acl = new Member_acl(); // $my_acl->getAllPerms(); $rPerms = $my_acl->getRolePerms($roleid); // var_dump($rPerms); $this->output->set_output('[' . $this->loop_parent($perm_parr, 0, 0, 0, '', $rPerms) . ']'); }
public static function user() { self::$ci =& get_instance(); if (self::$ci->session->userdata('member_userid')) { self::$ci->db->where('id', self::$ci->session->userdata('member_userid')); $user1 = self::$ci->db->get('users')->row(); if (isset($user1) && count($user1) > 0) { self::$ci->load->library('Member_acl'); $my_acl = new Member_acl($user1->id); // 用户角色 $userRoles = $my_acl->getUserRoles(); $user1->userRoles = $userRoles; // 用户权限 $userPerms = $my_acl->getPermArr('mini'); $user1->userPerms = $userPerms; return $user1; } else { return FALSE; } } else { return FALSE; } }
?> </select> </div> <?php if ($id != '') { ?> <p class="page-header">User Permissions <a href="#/users?m=set_perms&user_id=<?php echo $id; ?> " title="Change Permissions"><i class="fa fa-gear"></i></a></p> <div class="form-group"> <ul> <?php $my_acl = new Member_acl($id); $perms = $my_acl->getPermArr(); foreach ($perms as $k => $v) { if ($v['value'] === false) { continue; } echo "<li>" . $v['Name']; if ($v['inheritted']) { echo " (inherit)"; } echo "</li>"; } ?> </ul> </div> <?php
function perm_data() { $permissions = permissions_list(); $perm_parr = array(); foreach ($permissions as $row) { $perm_parr[$row->parent_id][] = $row; } $user_id = intval($this->input->post('user_id')); $this->load->library('Member_acl'); $my_acl = new Member_acl($user_id); $this->template_data['my_acl'] = $my_acl; $rPerms = $my_acl->getPermArr(); $this->template_data['rPerms'] = $rPerms; $this->output->set_output('[' . $this->loop_parent($perm_parr, 0, 0, 0, '', $rPerms) . ']'); }