Gets [[_username]] when defined, otherwise - `Yii::$app->user->identity->username`,
otherwise `Yii::$app->user->identity->getId()`.
@throws InvalidConfigException
@return string
353122
public function getUsername()
    {
        if (isset($this->_username)) {
            return $this->_username;
        } elseif (($identity = Yii::$app->user->identity) !== null) {
            if ($identity->hasProperty('username')) {
                $this->_username = $identity->username;
            } else {
                $this->_username = $identity->getId();
            }

            return $this->_username;
        }
        throw new InvalidConfigException('Unable to determine username');
    }
51473
protected function sectionCurrentUser()
	{
		$u = Yii::$app->user;
		if ($u->isGuest) return ['Is guest'=>$this->valueBool(true)];

		//basics
		$identity = Yii::$app->user->identity;
		$ret = [
			'Is guest'=>$this->valueBool($u->isGuest),
			'ID'=>$this->valueBool($u->id),
			'Identity'=>$this->valueModal('Identity', $this->valueVarDump($identity), 'Show identity class'),
		];

		//rbac
		if (Yii::$app->authManager !== null) {
			$am = Yii::$app->authManager;
			$assigns = [];
			$roles = [];
			$perms = [];

			foreach ($am->getAssignments($u->id) as $assign) {
				$assigns[] = $this->valueCode($assign->roleName);
			}
			foreach ($am->roles as $role) {
				$roles[] = Html::tag('span', $role->name, ['class'=>'label label-' . ($u->can($role->name) ? 'success' : 'danger')]);
			}
			foreach ($am->permissions as $perm) {
				$perms[] = Html::tag('span', $perm->name, ['class'=>'label label-' . ($u->can($perm->name) ? 'success' : 'danger')]);
			}

			$ret['Assigned to'] = implode(', ', $assigns);
			$ret['Roles'] = implode(' ', $roles);
			$ret['Permissions'] = implode(' ', $perms);
		}

		return $ret;
	}
741671
public function getConfig(): array
    {
        $config = ['user' => null, 'profile_picture_field' => null];

        $token = $this->tokenStorage->getToken();
        if (!$token instanceof TokenInterface) {
            return $config;
        }

        $user = $token->getUser();
        if ($user instanceof UserInterface) {
            $apiUser = $user->getAPIUser();
            $config['user'] = $apiUser;
            $config['profile_picture_field'] = $this->resolveProfilePictureField($apiUser);
        }

        return $config;
    }
685515
public function actionMe()
    {
        $user = $this->findModel(Yii::$app->user->id);
        return [
            'id' => $user->id,
            'username' => $user->username,
            'nickname' => $user->nickname,
            'email' => $user->email,
            'mobile' => $user->mobile,
            'mobile_confirmed_at' => $user->mobile_confirmed_at,
            'faceUrl' => $user->faceUrl,
            'identified' => $user->identified,
            'transfer_balance' => $user->transfer_balance,
            'balance' => $user->balance
        ];
    }
477643
public function actionUser()
    {
        while (true) {
            $email = $this->prompt('User E-Mail:');
            if (!empty(User::findByEmail($email))) {
                $this->outputError('The provided E-Mail already exists in the System.');
            } else {
                break;
            }
        }

        $titleArray = ['Mr' => 1, 'Mrs' => 2];
        $title = $this->select('Title:', $titleArray);

        $firstname = $this->prompt('Firstname:');
        $lastname = $this->prompt('Lastname:');
        $password = $this->prompt('User Password:');

        if ($this->confirm("Are you sure to create the User '$email'?") !== true) {
            return $this->outputError('Abort user creation process.');
        }

        $user = new User();
        $user->email = $email;
        $user->password_salt = Yii::$app->getSecurity()->generateRandomString();
        $user->password = Yii::$app->getSecurity()->generatePasswordHash($password.$user->password_salt);
        $user->firstname = $firstname;
        $user->lastname = $lastname;
        $user->title = $titleArray[$title];
        if (!$user->save()) {
            return $this->outputError('User validation error: ' . VarDumper::dumpAsString($user->getErrors()));
        }

        $groupSelect = [];

        foreach (Group::find()->all() as $entry) {
            $groupSelect[$entry->id] = $entry->name.' ('.$entry->text.')';
            $this->output($entry->id.' - '.$groupSelect[$entry->id]);
        }
        $groupId = $this->select('Select Group the user should belong to:', $groupSelect);

        $this->insert('{{%admin_user_group}}', [
            'user_id' => $user->id,
            'group_id' => $groupId,
        ]);

        return $this->outputSuccess("The user ($email) has been created.");
    }
418178
protected function getUser()
    {
        if ($this->_user === null) {
            $userClass = Yii::$app->user->identityClass;
            $this->_user = $userClass::findOne(['nickname' => $this->nickname]);
        }
        return $this->_user;
    }
829863
protected function resolveNameID()
    {
        if ($this->name !== null) {
            $name = $this->name;
            $id   = $this->name;
        } elseif ($this->hasModel()) {
            $name = Html::getInputName($this->model, $this->attribute);
            $id   = Html::getInputId($this->model, $this->attribute);
        } else {
            throw new \yii\base\Exception('Class must specify "model" and "attribute" or "name" property values.');
        }
        return [$name, $id];
    }
569372
public function getDefaultDatabaseName()
    {
        if ($this->_defaultDatabaseName === null) {
            if (preg_match('/^mongodb:\\/\\/.+\\/([^?&]+)/s', $this->dsn, $matches)) {
                $this->_defaultDatabaseName = $matches[1];
            } else {
                throw new InvalidConfigException("Unable to determine default database name from dsn.");
            }
        }

        return $this->_defaultDatabaseName;
    }
23658
public static function optionsUsers(): array
    {
        $options = ['' => '-'];

        foreach ((new UserService())->all() as $user) {
            $options[$user->userName()] = $user->realName() . ' - ' . $user->userName();
        }

        return $options;
    }
384494
public static function get()
	{
		$configFile = Yii::$app->params[Enum::CONFIG_FILE];
		$config = require($configFile);

		if (!is_array($config))
			return [];

		return $config;
	}
180020
public function getUsername() : ?string 
    {
        if ( ! $this->hasUsername()) {
            $this->setUsername($this->getDefaultUsername());
        }
        return $this->username;
    }
1178419
public function actionConfig()
    {
        // valid keys
        $keys = [Config::HTTP_EXCEPTION_NAV_ID];
        
        foreach (Yii::$app->request->bodyParams as $key => $value) {
            if (in_array($key, $keys)) {
                Config::set($key, $value);
            }
        }
        
        $data = [];
        $data[Config::HTTP_EXCEPTION_NAV_ID] = Config::get(Config::HTTP_EXCEPTION_NAV_ID, 0);
        $data['previewUrl'] = $this->module->previewUrl;
        return $data;
    }
618834
protected function requestData() : array
    {
        switch ($this->method) {
            case 'post':
                return Yii::$app->request->post();
            case 'get':
                return Yii::$app->request->getQueryParams();
            default:
                throw new InvalidConfigException('Request method is not defined');
        }
    }
924759
private function getAuthItemChild(){
         
        //get user name
        $user_id = Yii::app()->getModule('user')->user()->id;

        $new = Yii::app()->db->createCommand()
           ->select('itemname child')
           ->from('AuthAssignment')
           ->where('userid = :userid',array(':userid'=>$user_id))
           ->queryAll();             
         
         
         //init loop
         //$new[] = array('child' => $user_name);         
         $result = array();
         
         //load all leves uzth items
         while(!empty($new)){
             
            //create child list 
            $list = array(); 
            foreach ($new as $row){
                $list[] = $row['child'];
                
                //save result
                $result[$row['child']] = TRUE;
            }
             
            $new = Yii::app()->db->createCommand()
               ->select('child')
               ->from('AuthItemChild')
               ->where(array('in', 'parent', $list))
               ->queryAll();             
        }
        
        $this->_auth_items = $result;
         
     }
928707
public function getName()
    {
        if (!array_key_exists(self::NAME, $this->passwd)) {
            throw new \Exception('Could not get user name from passwd.');
        }
        return $this->passwd[self::NAME];
    }
538326
protected function validateStateConfig()
	{
		if (empty($this->stateConfig)) {
			$msg = Yii::t('app', 'Empty state configurations are not allowed');
			throw new InvalidConfigException($msg);
		}

		$config = &$this->stateConfig;
		foreach ($config as $i=>&$state) {
			//validate label and value
			if (empty($state['value']) || empty($state['label'])) {
				$msg = Yii::t('app', 'The label and the value of a state are mandatory');
				throw new InvalidConfigException($msg);
			}
			if (!is_int($state['value']) && !is_string($state['value'])) {
				$msg = Yii::t('app', 'The value must be a string or an integer ({lbl})', ['lbl'=>$state['label']]);
				throw new InvalidConfigException($msg);
			}

			//validate closures
			$callbackAttributes = ['preconditionCallback', 'enterStateCallback', 'leaveStateCallback'];
			foreach ($callbackAttributes as $cbAttr) {
				if (isset($state[$cbAttr]) && !($state[$cbAttr] instanceof \Closure)) {
					$msg = Yii::t('app', 'For {cb-attr} only closures are allowed', ['cb-attr'=>$cbAttr]);
					throw new InvalidConfigException($msg);
				}
			}

			//default settings
			if (!isset($state['groups'])) $state['groups'] = [];
			if (!isset($state['autoEnter'])) $state['autoEnter'] = true;

			//validate groups
			foreach ($state['groups'] as &$group) {
				if (!is_string($group)) {
					$msg = Yii::t('app', 'Only strings allowed for group names');
					throw new InvalidConfigException($msg);
				}
				$group = strtolower($group);
			}
		}

		return true;
	}
255828
protected function getComponent()
    {
        if (isset(Yii::$app->{$this->component}) && Yii::$app->{$this->component} instanceof Helper) {
            return Yii::$app->{$this->component};
        }
        throw new InvalidConfigException("Component '{$this->component}' not found in Yii::\$app");
    }