private static async Task SendAdminPanelCard(IDialogContext context, Activity activity, TeamsChannelData channelData)
        {
            var    reply      = activity.CreateReply();
            Tenant tenantData = await Common.CheckAndAddTenantDetails(channelData.Tenant.Id);

            reply.Attachments.Add(CardHelper.GetAdminPanelCard(string.Join(",", tenantData.Moderators)));
            await context.PostAsync(reply);
        }
Example #2
0
        public async Task <ActionResult> ConsentPage(string tenant, string admin_consent, string state)
        {
            if (string.IsNullOrEmpty(tenant))
            {
                return(HttpNotFound());
            }

            var adminUserDetails = JsonConvert.DeserializeObject <AdminUserDetails>(HttpUtility.UrlDecode(state));
            var tenantDetails    = await Cache.Tenants.GetItemAsync(tenant);

            tenantDetails.IsAdminConsented = true;
            tenantDetails.Admin            = adminUserDetails.UserEmailId;
            await Cache.Tenants.AddOrUpdateItemAsync(tenantDetails.Id, tenantDetails);

            var userDetails = await Cache.Users.GetItemAsync(adminUserDetails.UserEmailId);

            await ProactiveMessageHelper.SendPersonalNotification(adminUserDetails.ServiceUrl, tenant, userDetails, "Your app consent is successfully granted. Please go ahead and set groups & moderators.", null);

            await ProactiveMessageHelper.SendPersonalNotification(adminUserDetails.ServiceUrl, tenant, userDetails, null, CardHelper.GetAdminPanelCard(string.Join(",", tenantDetails.Moderators)));

            return(View());
        }