コード例 #1
0
ファイル: userinfo.php プロジェクト: Niqpue/zippyerp
 public function beforeRender()
 {
     parent::beforeRender();
     $roles = array();
     $roles[] = 'Пользователь';
     $rolelist = Role::find('role_id  in (select role_id from system_user_role where user_id  = ' . $this->user->user_id . ')');
     if (count($rolelist) > 0) {
         foreach ($rolelist as $role) {
             $roles[] = $role->description;
         }
     }
     $this->userroles->setText(implode('<br>', $roles), true);
 }
コード例 #2
0
ファイル: acl.php プロジェクト: Niqpue/zippyerp
 /**
  * Возвращает  роли  с  правами  доступа   к обьекту
  */
 public static function getRoleAccess($meta_id)
 {
     $conn = \ZCL\DB\DB::getConnect();
     $roles = \ZippyERP\System\Role::find();
     foreach (array_keys($roles) as $role_id) {
         $row = $conn->GetRow("select * from erp_metadata_access where metadata_id ={$meta_id} and role_id={$role_id}");
         if (is_array($row)) {
             $roles[$role_id]->viewacc = $row['viewacc'];
             $roles[$role_id]->editacc = $row['editacc'];
             $roles[$role_id]->deleteacc = $row['deleteacc'];
             $roles[$role_id]->execacc = $row['execacc'];
         }
     }
     return $roles;
 }
コード例 #3
0
ファイル: user.php プロジェクト: Niqpue/zippyerp
 /**
  * Принадлежность к роли
  * 
  * @param mixed $rolename
  */
 public function hasRole($rolename)
 {
     if ($this->roles == null) {
         $this->roles = array();
         $_roles = Role::find(' role_id in (select role_id from system_user_role where user_id = ' . $this->user_id . ')');
         foreach ($_roles as $_role) {
             $this->roles[] = $_role->rolename;
         }
     }
     return @in_array($rolename, $this->roles);
 }