protected function applyPermission(array $data)
    {
        if (!($name = ArrayHelper::get($data, 'name'))) {
            return false;
        }
        if ($permission = $this->authManager->getPermission($name)) {
            return $permission;
        }
        $permission = $this->authManager->createPermission($name);
        $permission->description = ArrayHelper::get($data, 'description', '');
        $permission->ruleName    = ArrayHelper::get($data, 'ruleName',    '');
        if ($this->authManager->add($permission)) {
            return $permission;
        }
        return false;
    }