Is the user allowed to edit non locked labels?

@param AccountInterface $account
@return boolean
971809
public function canEditNonLockedLabels(AccountInterface $account = null)
    {
        if ($account === null) {
            global $user;
            $account = $user;
        }

        return user_access(LabelAccess::PERM_EDIT_NON_LOCKED, $account);
    }
200306
public function signOn(array $account)
    {
        $cacheItemPool = $this->getCacheItemPool();
        $virtualUserId = md5(json_encode($account) . mt_srand() . time());
        $cacheItemPool->save(new Item('sso-' . $virtualUserId, $account, false));

        set_cookie('ssid', $virtualUserId);
    }
431455
public function edit($id)
    {
        if (!$this->request->is(['get', 'put'])) {
            throw new MethodNotAllowedException();
        }

        /** @var User $user */
        $user = $this->Users->getUserAndGroups($id);

        if ($this->request->is('put')) {
            $user = $this->Users->patchEntity($user, $this->request->data, ['associated' => 'Groups']);
            $userActivated = ($user->dirty('active') && $user->active);
            if ($userActivated) {
                // do not allow a user to be activated if his email address is not verified
                if (!$user->verified) {
                    $user->active = false;
                    $userActivated = false;
                } else {
                    $user->activate();
                }
            }
            $userDeactivated = ($user->dirty('active') && !$user->active);
            if ($userDeactivated) {
                // do not allow a user to deactivate his own account
                if ($user->id === Wasabi::user()->id) {
                    $user->active = true;
                    $userDeactivated = false;
                } else {
                    $user->deactivate();
                }
            }
            if ($this->Users->save($user, ['associated' => 'Groups'])) {
                if ($user->id === Wasabi::user()->id) {
                    $updateUser = $this->Users->get($user->id);
                    $updateUser->group_id = $this->Users->UsersGroups->getGroupIds($updateUser->id);
                    $this->Auth->setUser($updateUser->toArray());
                    Wasabi::user($updateUser);
                }
                if ($userActivated && $user->verified) {
                    $this->getMailer('Wasabi/Core.User')->send('activatedEmail', [$user]);
                }
                if ($userDeactivated && $user->verified) {
                    $this->getMailer('Wasabi/Core.User')->send('deactivatedEmail', [$user]);
                }
                $this->Flash->success(__d('pb', 'The user <strong>{0}</strong> has been updated.', $user->fullName()));
                $this->redirect($this->Filter->getBacklink(['action' => 'index'], $this->request));
                return;
            } else {
                $this->Flash->error($this->formErrorMessage);
            }
        }

        $groups = $this->Users->Groups->find('list')->order('id ASC');

        // users that are no admin, may not select the admin group
        if (Wasabi::user()->hasAccessLevel(Permission::OWN)) {
            $groups->where(['id <>' => 1]);
        }

        $this->set([
            'user' => $user,
            'groups' => $groups,
            'languages' => Hash::map(Configure::read('languages.backend'), '{n}', function ($language) {
                return [
                    'value' => $language->id,
                    'text' => $language->name
                ];
            })
        ]);

        $this->render('add');
    }
497257
public function canEditLabel(\stdClass $label, AccountInterface $account = null)
    {
        if ($account === null) {
            global $user;
            $account = $user;
        }

        return ($label->is_locked == 0)
            ? user_access(LabelAccess::PERM_EDIT_NON_LOCKED, $account)
            : user_access(LabelAccess::PERM_EDIT_LOCKED, $account);
    }
718733
public function isEditable(MediaInterface $media)
    {
        if (!$this->container->get('sonata.media.admin.media')->isGranted('EDIT', $media)) {
            return false;
        }

        return \in_array(strtolower($media->getExtension()), $this->validFormats, true);
    }
682576
public function myTopicAccess(AccountInterface $account) {
    // Fetch user from url.
    $user = $this->requestStack->getCurrentRequest()->get('user');

    // If we don't have a user in the request, assume it's my own profile.
    if (is_null($user)) {
      // Usecase is the user menu, which is generated on all LU pages.
      $user = User::load($account->id());
    }

    // If not a user then just return neutral.
    if (!$user instanceof User) {
      $user = User::load($user);

      if (!$user instanceof User) {
        return AccessResult::neutral();
      }
    }

    // Own profile?
    if ($user->id() === $account->id()) {
      return AccessResult::allowedIfHasPermission($account, 'view topics on my profile');
    }
    return AccessResult::allowedIfHasPermission($account, 'view topics on other profiles');
  }
926323
public function edit($id) {
        // Is this record locked?
        if ($this->repository->isLocked($id))
        {
            $response = 'This user is not available for editing, as someone else is currently editing this user';
            Session::flash('message', $response);
            Session::flash('status_code', 400 );
            return Redirect::route('admin.users.index');
        }


        // My custom helpful HELPER method "adminPageSubTitle()" displays the "title" field of a record.
        // There is no such "title" field in the users table. So, let's pretend, to make my helpful helper method happy!
        $user = $this->repository->getFind($id);
        $user->title = $user->name;

        // Lock the record
        $this->repository->populateLockFields($id);

        $field = [
            'name'                => 'groups',
            'related_table_name'  => 'groups',
            'related_model_class' => 'Group',
        ];

        return view('lasallecmsadmin::'.config('lasallecmsadmin.admin_template_name').'/users/create',[
            'repository'  => $this->repository,
            'field'       => $field,
            'pagetitle'   => 'Users',
            'DatesHelper' => DatesHelper::class,
            'Form'        => Form::class,
            'HTMLHelper'  => HTMLHelper::class,
            'user'         => $user,
        ]);
    }
560881
public function toggleOnboarding(array $account = NULL) {

    // No user given, then current user.
    $id = $this->currentUser->id();
    if ($account instanceof User) {
      $id = $account->id();
    }

    $new_value = TRUE;
    if ($this->userData->get('social_tour', $id, 'onboarding_disabled') == TRUE) {
      $new_value = FALSE;
    }

    // Save the value in the user_data.
    $this->setData($new_value);
  }
1035344
public function canEdit($member)
    {
        if (!Permission::check('EDIT_EMBARGOED_WORKFLOW') && // not given global/override permission to edit
            !$this->owner->AllowEmbargoedEditing) { // item flagged as not editable
            $publishTime = $this->owner->dbObject('PublishOnDate');

            if ($publishTime && $publishTime->InFuture() || // when scheduled publish date is in the future
                // when there isn't a publish date, but a Job is in place (publish immediately, but queued jobs is
                // waiting)
                (!$publishTime && $this->owner->PublishJobID != 0)
            ) {
                return false;
            }
        }
    }
537895
public function remove(AccountType $accountType): bool
    {
        if (empty($accountType->email)) {
            return false;
        }

        $uri = sprintf(
            '%s/accounts/%s/',
            $this->clipUri($this->client->getConfig('base_uri')),
            $accountType->email
        );

        return $this->client->delete($uri)->getStatusCode() === 200;
    }
529070
public function userCanSwitch(AccountInterface $account, $site, $state)
    {
        $allowed = $this->getAllowedTransitions($account, $site);

        return isset($allowed[$state]);
    }
627313
public function getAccounContact(AccountInterface $account, Contact $contact)
    {
        foreach ($contact->getAccountContacts() as $accountContact) {
            /** @var AccountContact $accountContact */
            if ($accountContact->getAccount() === $account) {
                return $accountContact;
            }
        }

        return;
    }
539290
public function isAnswerAllowed(UserInterface $user, $answer)
    {
        $answerEntity = $this->getEntityManagerAnswer()->getAnswer4UserId($user->getId());

        if (!$answerEntity) {
            return true;
        }

        // @TODO better workflow, with ZendFilter
        $realAnswer = strtolower(trim($answerEntity->getAnswer()));
        $plainAnswer = strtolower(trim($answer));

        return $realAnswer === $plainAnswer;
    }
445238
public function canEditMenu(Menu $menu, AccountInterface $account)
    {
        return $account->hasPermission(self::PERM_MANAGE_ALL_MENU) || $this->isUserWebmaster($menu, $account);
    }
711507
public function userCanEditNodeSeo(AccountInterface $account, NodeInterface $node) : bool
    {
        return
            !$this->isNodeBlacklisted($node) && (
                ($account->hasPermission(SeoService::PERM_SEO_CONTENT_OWN) && $node->access('update', $account)) ||
                ($account->hasPermission(SeoService::PERM_SEO_CONTENT_ALL) && $node->access('view', $account))
            )
        ;
    }
464456
public function isEntityLocked(User $user, LockableEntityInterface $entity)
    {
        /** @var LockableEntity $lockable */
        $lockable = $this->getLockableEntity($entity);

        if ($this->lockEnabled) {
            $this->removeExpiredLocks($lockable);
            $locks = $this->getEntityVersionLocksByLockableEntity($lockable, $user);

            if ($locks === null || !count($locks)) {
                $this->createEntityVersionLock($user, $lockable);

                $lockable->setUpdated(new \DateTime());
                $this->objectManager->flush();

                return false;
            }

            return true;
        }

        return false;
    }
61649
public function removeAddressRelation($account, $accountAddress)
    {
        if (!$account || !$accountAddress) {
            throw new \Exception('Account and AccountAddress cannot be null');
        }

        // Reload address to get all data (including relational data).
        /** @var AddressEntity $address */
        $address = $accountAddress->getAddress();
        $address = $this->em->getRepository('SuluContactBundle:Address')
            ->findById($address->getId());

        $isMain = $accountAddress->getMain();

        // Remove relation.
        $address->removeAccountAddress($accountAddress);
        $account->removeAccountAddress($accountAddress);

        // If was main, set a new one.
        if ($isMain) {
            $this->setMainForCollection($account->getAccountContacts());
        }

        // Delete address if it has no more relations.
        if (!$address->hasRelations()) {
            $this->em->remove($address);
        }

        $this->em->remove($accountAddress);
    }