Esempio n. 1
0
            public async Task CheckValidityAsync(CallContext callContext)
            {
                await QueryValidationHelper.CheckCanCreateLanguageWithName(Name, callContext.DbContext, callContext.Localized);

                await QueryValidationHelper.CheckUserExistsAsync(callContext.DbContext, UserId);

                var user = await callContext.DbContext.Users.AsNoTracking().SingleAsync(user => user.Id == UserId);

                if (!await callContext.RoleChecker.UserIsAdminAsync(user))
                {
                    throw new InvalidOperationException("User not admin");
                }
            }