Returns a QR-code image for logging in.

@param string $community
@param boolean $mustJoin
@param boolean $needsActivation
@param \GpsNose\SDK\Mashup\Model\GnMashupLoginAcl $acls
@return array(Byte)
552946
public function GenerateQrCode(string $community = GnSettings::GPSNOSE_COMMUNITY, bool $mustJoin = FALSE, bool $needsActivation = FALSE, int $acls = GnMashupLoginAcl::None)
    {
        if (GnUtil::IsNullOrEmpty($community)) {
            throw new \InvalidArgumentException("community required");
        }

        if ($this->_isMashupAdmin) {
            if ($community !== GnSettings::GPSNOSE_COMMUNITY) {
                throw new GnException("community for mashup-admin must be {GnSettings.GPSNOSE_COMMUNITY}");
            }
        } else {
            if ($community === GnSettings::GPSNOSE_COMMUNITY) {
                throw new GnException("community for mashup-admin must be not {GnSettings.GPSNOSE_COMMUNITY}");
            }
        }

        $res = $this->ExecuteCall("GenerateQrCode", (object) [
            "loginId" => $this->_loginId,
            "community" => strtolower(trim($community)),
            "activation" => $needsActivation,
            "mustJoin" => $mustJoin,
            "acls" => (string) ((int) $acls)
        ]);

        return $res;
    }
460047
public function create($username, $password, $callbackUrl = '', $email = '', $description = '', $needsLocation = false)
    {
        $data = array(
            'new_account_username' => strtoupper($username),
            'new_account_passcode' => $password,
            'callback_url'         => $callbackUrl,
            'email'                => $email,
            'description'          => $description,
            'needs_location'       => $needsLocation ? 'true' : 'false',
            'api_token'            => $this->apiToken,
        );

        $this->send('accounts/', InternalRequestInterface::METHOD_POST, $data);
    }
95630
public static function GetUrlForImage(int $itemType = GnUrlItemType::Community, string $itemKey = NULL, int $sizeType = GnThumbnailSize::Size_Full)
    {
        $sizeSuffix = $sizeType == GnThumbnailSize::Size_Full ? "" : "@{$sizeType}";

        switch ($itemType) {
            case GnUrlItemType::Community:
                return static::$DataUrl . "/commimg/{$itemKey}{$sizeSuffix}";
            case GnUrlItemType::Event:
                return static::$DataUrl . "/eventsimg/{$itemKey}{$sizeSuffix}";
            case GnUrlItemType::Impression:
                return static::$DataUrl . "/impression/{$itemKey}{$sizeSuffix}";
            case GnUrlItemType::Nose:
                return static::$DataUrl . "/profimg/{$itemKey}{$sizeSuffix}";
            case GnUrlItemType::PoI:
                return static::$DataUrl . "/locimg/{$itemKey}{$sizeSuffix}";

                // track has no image
            case GnUrlItemType::Track:
                return NULL;
        }

        throw new GnException("unexpected itemType={$itemType}");
    }
1043994
public static function loadRoster($membership_url, $access_token, &$debug_log=false) {

        $ch = curl_init();

        $membership_url = trim($membership_url);

        $headers = [
            'Authorization: Bearer '. $access_token,
            'Accept: '.self::MEDIA_TYPE_MEMBERSHIPS,
            'Content-Type: '.self::MEDIA_TYPE_MEMBERSHIPS // TODO: Remove when certification is fixed
        ];

        curl_setopt($ch, CURLOPT_URL, $membership_url);
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

        if ( is_array($debug_log) ) $debug_log[] = $membership_url;
        if ( is_array($debug_log) ) $debug_log[] = $headers;

        $membership = curl_exec($ch);
        $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close ($ch);
        if ( is_array($debug_log) ) $debug_log[] = "Sent roster request, received status=$httpcode (".strlen($membership)." characters)";

        if ( strlen($membership) < 1 ) {
            return "No data retrieved status=" . $httpcode;
        }

        $json = json_decode($membership, false);   // Top level object
        if ( $json === null ) {
            $retval = "Unable to parse returned roster JSON:". json_last_error_msg();
            if ( is_array($debug_log) ) {
                if (is_array($debug_log) ) $debug_log[] = $retval;
                if (is_array($debug_log) ) $debug_log[] = substr($membership, 0, 3000);
            }
            return $retval;
        }

        if ( $httpcode == 200 && isset($json->members) ) {
            if ( is_array($debug_log) ) $debug_log[] = "Loaded ".count($json->members)." roster entries";
            return $json;
        }

        $status = isset($json->error) ? $json->error : "Unable to load results";
        if ( is_array($debug_log) ) $debug_log[] = "Error status: $status";
        return $status;
    }
644777
function acs()
    {

        /** @var $auth OneLogin_Saml2_Auth */
        $auth = $this->auth;

        $auth->processResponse();

        $errors = $auth->getErrors();

        if (!empty($errors)) {
            return $errors;
        }

        if (!$auth->isAuthenticated()) {
            return array('error' => 'Could not authenticate');
        }

        return null;

    }
83745
public static function getAllReasonsCategories($hasAccessToReactivate = false){
        /** @var ReasonCategoryService $categoryService */
        $categoryService = ServiceManager::getServiceManager()->get(ReasonCategoryService::SERVICE_ID);

        $response = array(
            'authorize' => array(),
            'pause' => $categoryService->getIrregularities(),
            'terminate' => $categoryService->getIrregularities(),
            'report' => $categoryService->getIrregularities(),
            'print' => [],
        );
        if ($hasAccessToReactivate) {
            $response['reactivate'] = $categoryService->getIrregularities();
        }

        return $response;
    }
1290386
public function GetImpressionsAround(string $community = NULL)
    {
        $result = $this->ExecuteCall("GetImpressionsAround", (object)[
            "community" => $community
        ], GnResponseType::ListGnImpression, FALSE, PHP_INT_MAX);

        return $result;
    }
687731
Map<CmsUUID, CmsAccessControlEntry> buildAceMap(Collection<CmsAccessControlEntry> acl) {

        if (acl == null) {
            acl = new ArrayList<>();
        }
        Map<CmsUUID, CmsAccessControlEntry> result = new HashMap<>();
        for (CmsAccessControlEntry ace : acl) {
            result.put(ace.getPrincipal(), ace);
        }
        return result;
    }
157788
function acl2text($rights)
    {
        if (empty($rights)) {
            return '';
        }

        $supported = $this->rights_supported();
        $list      = array();
        $attrib    = array(
            'name' => 'rcmyrights',
            'style' => 'margin:0; padding:0 15px;',
        );

        foreach ($supported as $right) {
            if (in_array($right, $rights)) {
                $list[] = html::tag('li', null, rcube::Q($this->gettext('acl' . $right)));
            }
        }

        if (count($list) == count($supported))
            return rcube::Q($this->gettext('aclfull'));

        return html::tag('ul', $attrib, implode("\n", $list));
    }
1263468
protected function getAuthorizationActions(AuthorizationContract $acl, $metric)
    {
        return collect($acl->actions()->get())->map(function ($slug) use ($metric) {
            $key = "orchestra/foundation::acl.{$metric}.{$slug}";
            $name = $this->translator->has($key) ? $this->translator->get($key) : Str::humanize($slug);

            return compact('slug', 'name');
        });
    }
972296
public function getSubscribeFrame(
        $destination,
        $subscriptionId = null,
        $ack = 'auto',
        $selector = null,
        $durable = false
    ) {
        $frame = parent::getSubscribeFrame($destination, $subscriptionId, $ack, $selector);
        $frame['activemq.prefetchSize'] = $this->prefetchSize;
        if ($durable) {
            $frame['activemq.subscriptionName'] = $this->getClientId();
        }
        return $frame;
    }
1240283
public static function create($postcode, $requireFull = false)
    {
        $obj = new self($postcode);

        if ($requireFull && !$obj->getPostcode()) {
            return null;
        }

        if (!$obj->getPostcodeArea()) {
            return null;
        }

        return $obj;
    }
1266030
final public function getConnectFrame(
        $login = '',
        $passcode = '',
        array $versions = [],
        $host = null,
        $heartbeat = [0, 0]
    ) {
        $frame = $this->createFrame('CONNECT');
        $frame->legacyMode(true);

        if ($login || $passcode) {
            $frame->addHeaders(['login' => $login, 'passcode' => $passcode]);
        }

        if ($this->hasClientId()) {
            $frame['client-id'] = $this->getClientId();
        }

        if (!empty($versions)) {
            $frame['accept-version'] = implode(',', $versions);
        }

        $frame['host'] = $host;

        $frame['heart-beat'] = $heartbeat[0] . ',' . $heartbeat[1];

        return $frame;
    }
631259
public function GetPoIsAround(string $community = NULL)
    {
        $result = $this->ExecuteCall("GetPoIsAround", (object)[
            "community" => $community
        ], GnResponseType::ListGnPoI, FALSE, PHP_INT_MAX);

        return $result;
    }
905579
protected function getNecessaryJoins($necessaryEntityNames)
    {
        $addJoins = [];

        // iterate through all field descriptors to find necessary joins
        foreach ($this->getAllFields() as $key => $field) {
            // if field is in any conditional clause -> add join
            if (($field instanceof DoctrineFieldDescriptor || $field instanceof DoctrineJoinDescriptor) &&
                false !== array_search($field->getEntityName(), $necessaryEntityNames)
                && $field->getEntityName() !== $this->entityName
            ) {
                $addJoins = array_merge($addJoins, $field->getJoins());
            } else {
                // include inner joins
                foreach ($field->getJoins() as $entityName => $join) {
                    if (DoctrineJoinDescriptor::JOIN_METHOD_INNER !== $join->getJoinMethod() &&
                        false === array_search($entityName, $necessaryEntityNames)
                    ) {
                        break;
                    }
                    $addJoins = array_merge($addJoins, [$entityName => $join]);
                }
            }
        }

        if ($this->user && $this->permission && array_key_exists($this->permission, $this->permissions)) {
            foreach ($this->permissionCheckFields as $permissionCheckField) {
                $addJoins = array_merge($addJoins, $permissionCheckField->getJoins());
            }
        }

        return $addJoins;
    }
1188373
public function getChildACL()
    {
        $acl = [];

        switch ($this->getShareAccess()) {
            case SPlugin::ACCESS_NOTSHARED:
            case SPlugin::ACCESS_SHAREDOWNER:
            case SPlugin::ACCESS_READWRITE:
                $acl[] = [
                    'privilege' => '{DAV:}write',
                    'principal' => $this->calendarInfo['principaluri'],
                    'protected' => true,
                ];
                $acl[] = [
                    'privilege' => '{DAV:}write',
                    'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write',
                    'protected' => true,
                ];
                // no break intentional
            case SPlugin::ACCESS_READ:
                $acl[] = [
                    'privilege' => '{DAV:}read',
                    'principal' => $this->calendarInfo['principaluri'],
                    'protected' => true,
                ];
                $acl[] = [
                    'privilege' => '{DAV:}read',
                    'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-write',
                    'protected' => true,
                ];
                $acl[] = [
                    'privilege' => '{DAV:}read',
                    'principal' => $this->calendarInfo['principaluri'].'/calendar-proxy-read',
                    'protected' => true,
                ];
                break;
        }

        return $acl;
    }
853454
private static function getExistingJoin(QueryBuilder $queryBuilder, string $alias, string $association, string $originAlias = null): ?Join
    {
        $parts = $queryBuilder->getDQLPart('join');
        $rootAlias = $originAlias ?? $queryBuilder->getRootAliases()[0];

        if (!isset($parts[$rootAlias])) {
            return null;
        }

        foreach ($parts[$rootAlias] as $join) {
            /** @var Join $join */
            if (sprintf('%s.%s', $alias, $association) === $join->getJoin()) {
                return $join;
            }
        }

        return null;
    }