public override async Task <MenuGrantResultEnum> CheckAsync(MenuGrantRuntimeCheckerContent context)
        {
            var userId = context.Principal?.FindFirst(AbpClaimTypes.UserId)?.Value;
            var result = await MenuGrantChecker.CheckAsync(context.Menu.Id, "U", userId);

            return(result.IsGranted ? MenuGrantResultEnum.Granted : MenuGrantResultEnum.Undefined);
        }
        public async Task <bool> CheckAsync(ClaimsPrincipal claimsPrincipal, Menu menu)
        {
            var multiTenancySide = claimsPrincipal?.GetMultiTenancySide()
                                   ?? _currentTenant.GetMultiTenancySide();

            if (!menu.MultiTenancySide.HasFlag(multiTenancySide))
            {
                return(false);
            }

            var isGranted = false;
            var content   = new MenuGrantRuntimeCheckerContent
            {
                Menu      = menu,
                Principal = claimsPrincipal
            };

            foreach (var provider in _checkerProviders)
            {
                var result = await provider.CheckAsync(content);

                if (result == MenuGrantResultEnum.Granted)
                {
                    isGranted = true;
                    break;
                }
            }

            return(isGranted);
        }
        public override async Task <MenuGrantResultEnum> CheckAsync(MenuGrantRuntimeCheckerContent context)
        {
            var roles = context.Principal?.FindAll(AbpClaimTypes.Role).Select(c => c.Value).ToArray();

            if (roles == null || !roles.Any())
            {
                return(MenuGrantResultEnum.Undefined);
            }

            foreach (var role in roles)
            {
                var result = await MenuGrantChecker.CheckAsync(context.Menu.Id, "R", role);

                if (result.IsGranted)
                {
                    return(MenuGrantResultEnum.Granted);
                }
            }

            return(MenuGrantResultEnum.Undefined);
        }
 public abstract Task <MenuGrantResultEnum> CheckAsync(MenuGrantRuntimeCheckerContent context);