findPostingsForAccount

@author Tom Haskins-Vaughan <tom@harvestcloud.com>
@since  2013-02-06

@param  Account $account

@return array
17474
public function findPostingsForAccount(Account $account)
    {
        $q = $this->getEntityManager()->createQuery('

            SELECT     p
            FROM       HarvestCloudCoreBundle:Posting p
            WHERE      p.account = :account

        ')->setParameter('account', $account);

        return $q->getResult();
    }
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');
  }
871791
public function get_properties($account_id) {
		$result = array();
		try {
			if ( $this->ga ) {
				$properties = $this->ga
					->management_webproperties
					->listManagementWebproperties( $account_id );
				$result     = $properties->getItems();
			}
		} catch ( \Exception $e ) {
			// Do nothing.
			error_log($e->getMessage(), $e->getCode());
		}
		return $result;
	}
140271
public function getAccounts()
    {
        $accounts = [];
        $groups   = $this->rpc->query("listAccounts", [0]);
        foreach($groups as $account => $balance) {
            $accounts[] = $account;
        }
        
        return $accounts;
    }
1197357
public function getAccountPictureBlob($accountName)
    {
        $username = $this->connection->getCanonicalAccountName($accountName, Enum\CanonicalAccountNameForm::USERNAME);

        /** @var Collection\DisconnectedZendLdapNodeCollection $results */
        $results = $this->connection->search(
            $this->buildFilter(
                new Filter\StringFilter($this->connection->getConfiguration()->getAccountUsernameAttribute() . '=' . Filter\AbstractFilter::escapeValue($username))
            ),
            $this->getSearchBaseDn(),
            Ldap::SEARCH_SCOPE_SUB,
            array($this->getConfiguration()->getAccountPictureAttribute()),
            null,
            '\WMS\Library\Ldap\Collection\DisconnectedZendLdapNodeCollection',
            1
        );

        if ($results->count() === 0) {
            return null;
        }

        return $results->getFirst()->getAttribute($this->getConfiguration()->getAccountPictureAttribute(), 0);
    }
791050
public function findAll($locale, $filter = null)
    {
        if ($filter) {
            $accountEntities = $this->accountRepository->findByFilter($filter);
        } else {
            $accountEntities = $this->accountRepository->findAll();
        }

        if (!empty($accountEntities)) {
            $accounts = [];
            foreach ($accountEntities as $account) {
                $accounts[] = $this->getApiObject($account, $locale);
            }

            return $accounts;
        }

        return;
    }
615993
public function getAccountData(\Flowpack\SingleSignOn\Server\Domain\Model\SsoClient $ssoClient, \TYPO3\Flow\Security\Account $account) {
		if ($this->configuration !== NULL) {
			$configuration = $this->configuration;
		} else {
			$configuration = $this->getDefaultConfiguration($ssoClient, $account);
		}
		$partyData = $this->transformValue($account->getParty(), $configuration['party']);
		$mappedRoles = array();
		foreach ($account->getRoles() as $role) {
			$mappedRoles[] = $role->getIdentifier();
		}
		return array(
			'accountIdentifier' => $account->getAccountIdentifier(),
			'roles' => $mappedRoles,
			'party' => $partyData
		);
	}
321127
public function get($account, $action = '', $parameters = null, $acceptableContentTypes = null)
    {
        if (is_array($account)) {
            $tmp_results = array();
            foreach ($account as $accnt) {
                $result = $this->sendRequest('GET', $accnt, $action, $parameters, null, $acceptableContentTypes);
                if ($result === false) {
                    return false;
                }
                $tmp_results[ $accnt ] = $result;
            }
            
            return $tmp_results;
        }
        
        return $this->sendRequest('GET', $account, $action, $parameters, null, $acceptableContentTypes);
    }
991040
public function getAddressesByAccount($account)
    {
        $args = [
            (string)$account
        ];
        return $this->rpc->query(__FUNCTION__, $args);
    }
1039584
public function findOrdersByStatusAndAccount($locale, $status, AccountInterface $account)
    {
        try {
            $qb = $this->getOrderQuery($locale)
                ->leftJoin('o.creator', 'creator')
                ->leftJoin('creator.contact', 'contact')
                ->leftJoin('contact.accountContacts', 'accountContact', 'WITH', 'accountContact.main = true')
                ->leftJoin('accountContact.account', 'account')
                ->andWhere('status.id = :statusId')
                ->andWhere('account = :account')
                ->setParameter('account', $account)
                ->setParameter('statusId', $status);

            return $qb->getQuery()->getResult();
        } catch (NoResultException $exc) {
            return null;
        }
    }
1125051
public function equals(Account $account): bool
    {
        if ($this->name !== $account->name) {
            return false;
        }

        if (!$this->homePage->equals($account->homePage)) {
            return false;
        }

        return true;
    }
674206
public function markEntityNotificationsAsRead(AccountInterface $account, Entity $entity) {

    // Retrieve all the activities referring this entity for this account.
    $ids = $this->getNotificationIds($account, [ACTIVITY_STATUS_RECEIVED, ACTIVITY_STATUS_SEEN], $entity);

    foreach ($ids as $activity_id) {
      $activity = Activity::load($activity_id);
      $this->changeStatusOfActivity($activity, ACTIVITY_STATUS_READ);
    }

  }
640639
public function getAccountByAddress($address)
    {
        $args = [
            (string)$address
        ];
        $account = $this->rpc->query("getAccount", $args);

        return !empty($account) ? $account : null;
    }
768690
public function blackAdd($account)
    {
        $request = new AddBlackRequest($this->identifier, $account);
        $response = new BaseResponse();
        return $this->client->sendRequest($request, $response);
    }
1243338
public function update(string $account, string $nickname)
    {
        $params = [
            'kf_account' => $account,
            'nickname' => $nickname,
        ];

        return $this->httpPostJson('customservice/kfaccount/update', $params);
    }
1250567
public function getAccountActivationToken()
    {
        $username = $this->httpRequest()->post('username');
        $token = $this->getLoginInstance()->getAccountConfirmationToken($username);

        return ['accountActivationToken' => $token];
    }
419102
public function getGroupsAccounts()
  {
    //Is Group: Further accounts can be made under Groups, but entries can be made against non-Groups
    $accounts = array();

    $this->Account->byOrganization($this->AuthenticationManager->getCurrentUserOrganizationId())->each(function($Account) use (&$accounts)
    {
      if($Account->is_group)
      {
        array_push($accounts, array('label'=> $Account->key . ' ' . $Account->name, 'value'=>$Account->id));
      }
    });

    return $accounts;
  }