예제 #1
0
        protected virtual async Task RevokeAsync(Guid menuId, string providerKey)
        {
            var permissionGrant = await MenuGrantRepository.FindAsync(menuId, Name, providerKey);

            if (permissionGrant == null)
            {
                return;
            }

            await MenuGrantRepository.DeleteAsync(permissionGrant);
        }
예제 #2
0
        private async Task InsertMenuGrantAsync(DataSeedContext context)
        {
            foreach (var menuId in await MenuDataSeedProvider.GetGrantMenuIdsAsync(context))
            {
                if ((await MenuGrantRepository.FindAsync(menuId, "R", AdminRoleName)) != null)
                {
                    continue;
                }

                await MenuGrantRepository.InsertAsync(new MenuGrant(
                                                          GuidGenerator.Create(),
                                                          menuId,
                                                          "R",
                                                          AdminRoleName,
                                                          context.TenantId));
            }
        }
예제 #3
0
        protected virtual async Task GrantAsync(Guid menuId, string providerKey)
        {
            var menuGrant = await MenuGrantRepository.FindAsync(menuId, Name, providerKey);

            if (menuGrant != null)
            {
                return;
            }

            await MenuGrantRepository.InsertAsync(
                new MenuGrant(
                    GuidGenerator.Create(),
                    menuId,
                    Name,
                    providerKey,
                    CurrentTenant.Id
                    )
                );
        }