コード例 #1
0
        private async void DummyRoleCheckMethod()
        {
            KenticoUserManager UserManager = HttpContext.GetOwinContext().Get <KenticoUserManager>();
            User CurrentUser = UserManager.FindByName(User.Identity.Name);

            //DocSection:CheckRole
            // Checks whether the current user is assigned to the "KenticoRole" role
            if (await UserManager.IsInRoleAsync(CurrentUser.Id, "KenticoRole"))
            {
                // ...
            }
            //EndDocSection:CheckRole
        }