Ejemplo n.º 1
0
        public async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "get", Route = null)] HttpRequest req,
            ILogger log)
        {
            log.LogInformation("C# HTTP trigger CheckKeyword function processed a request.");
            string tenant = req.Headers[Constants.HEADER_TENANT];

            if (String.IsNullOrWhiteSpace(tenant))
            {
                tenant = null;
            }
            ServerSettings serverSettings;

            if (null == tenant)
            {
                serverSettings = await _serverSettingsRepository.GetServerSettings();
            }
            else
            {
                serverSettings = await _serverSettingsRepository.GetServerSettings(tenant);
            }
            string keyword = req.Headers[Constants.HEADER_KEYWORD];

            KeywordCheck keywordCheck = new KeywordCheck();

            if (!String.IsNullOrEmpty(keyword))
            {
                keywordCheck.IsUser  = keyword.Equals(serverSettings.UserKeyword);
                keywordCheck.IsAdmin = keyword.Equals(serverSettings.AdminKeyword);
            }
            if (keywordCheck.IsAdmin)
            {
                // Admin is user, too
                keywordCheck.IsUser = true;
            }

            return(new OkObjectResult(keywordCheck));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> CheckKeyword([FromHeader(Name = "x-meetup-tenant")] string tenant, [FromHeader(Name = "x-meetup-keyword")] string keyword)
        {
            KeywordCheck keywordCheck = await _meetUpFunctions.CheckKeyword(tenant, keyword);

            return(Ok(keywordCheck));
        }