private bool ResourceOrScopeMatch()

in Office365APIEditor/UI/RequestForm.cs [1930:1964]


        private bool ResourceOrScopeMatch(string URL)
        {
            if (clientInfo != null)
            {
                switch (clientInfo.Resource)
                {
                    case Resources.Outlook:
                        return URL.StartsWith("https://outlook.office.com/api", StringComparison.InvariantCultureIgnoreCase);
                    case Resources.Graph:
                        return URL.StartsWith("https://graph.microsoft.com/", StringComparison.InvariantCultureIgnoreCase);
                    case Resources.Management:
                        return URL.StartsWith("https://manage.office.com/api/", StringComparison.InvariantCultureIgnoreCase);
                    case Resources.AzureRM:
                        return URL.StartsWith("https://management.azure.com/", StringComparison.InvariantCultureIgnoreCase);
                    case Resources.None:
                        if ((URL.StartsWith("https://outlook.office.com/api", StringComparison.InvariantCultureIgnoreCase) && clientInfo.Scopes.Contains("https://outlook.office.com/")) ||
                            (URL.StartsWith("https://graph.microsoft.com/", StringComparison.InvariantCultureIgnoreCase) && clientInfo.Scopes.Contains("https://graph.microsoft.com/")) ||
                            (URL.StartsWith("https://manage.office.com/api/", StringComparison.InvariantCultureIgnoreCase) && clientInfo.Scopes.Contains("https://manage.office.com/")) ||
                            (URL.StartsWith("https://management.azure.com/", StringComparison.InvariantCultureIgnoreCase) && clientInfo.Scopes.Contains("https://management.azure.com/")))
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    default:
                        return false;
                }
            }
            else
            {
                return false;
            }
        }