classes/rest/azuread.php [157:194]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        $this->token->refresh();
        $neededperms = $this->get_required_permissions();
        unset($neededperms['graph']);
        $allappdata = $this->get_service_data($neededperms);
        $currentperms = $this->get_current_permissions();
        $missingperms = [];
        foreach ($neededperms as $api => $apidata) {
            $appid = $apidata['appId'];
            $appname = $allappdata[$appid]['appDisplayName'];
            $requiredperms = $apidata['requiredDelegatedPermissions'];
            $availableperms = $allappdata[$appid]['perms'];
            foreach ($requiredperms as $permname => $altperms) {
                // First we assemble a list of permission IDs, indexed by permission name.
                $permids = [];
                $permstocheck = array_merge([$permname], $altperms);
                foreach ($permstocheck as $permtocheckname) {
                    if (isset($availableperms[$permtocheckname])) {
                        $permids[$permtocheckname] = $availableperms[$permtocheckname]['id'];
                    }
                }
                if (empty($permids)) {
                    // If $permids is empty no candidate permissions exist in the application.
                    $missingperms[$appname][$permname] = $permname;
                } else {
                    $permsatisfied = false;
                    foreach ($permids as $permidsname => $permidsid) {
                        if (isset($currentperms[$appid][$permidsid])) {
                            $permsatisfied = true;
                            break;
                        }
                    }
                    if ($permsatisfied === false) {
                        if (isset($availableperms[$permname]['adminConsentDisplayName'])) {
                            $permdesc = $availableperms[$permname]['adminConsentDisplayName'];
                        } else {
                            $permdesc = $permname;
                        }
                        $missingperms[$appname][$permname] = $permdesc;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



classes/rest/unified.php [1784:1821]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        $this->token->refresh();
        $neededperms = $this->get_required_permissions();
        unset($neededperms['graph']);
        $allappdata = $this->get_service_data($neededperms);
        $currentperms = $this->get_current_permissions();
        $missingperms = [];
        foreach ($neededperms as $api => $apidata) {
            $appid = $apidata['appId'];
            $appname = $allappdata[$appid]['appDisplayName'];
            $requiredperms = $apidata['requiredDelegatedPermissions'];
            $availableperms = $allappdata[$appid]['perms'];
            foreach ($requiredperms as $permname => $altperms) {
                // First we assemble a list of permission IDs, indexed by permission name.
                $permids = [];
                $permstocheck = array_merge([$permname], $altperms);
                foreach ($permstocheck as $permtocheckname) {
                    if (isset($availableperms[$permtocheckname])) {
                        $permids[$permtocheckname] = $availableperms[$permtocheckname]['id'];
                    }
                }
                if (empty($permids)) {
                    // If $permids is empty no candidate permission exists in the application.
                    $missingperms[$appname][$permname] = $permname;
                } else {
                    $permsatisfied = false;
                    foreach ($permids as $permidsname => $permidsid) {
                        if (isset($currentperms[$appid][$permidsid])) {
                            $permsatisfied = true;
                            break;
                        }
                    }
                    if ($permsatisfied === false) {
                        if (isset($availableperms[$permname]['adminConsentDisplayName'])) {
                            $permdesc = $availableperms[$permname]['adminConsentDisplayName'];
                        } else {
                            $permdesc = $permname;
                        }
                        $missingperms[$appname][$permname] = $permdesc;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



