Exemple #1
0
        public async Task <TPermissionUser> CreateAsync(TPermissionUser permissionUser, CancellationToken cancellationToken)
        {
            permissionUser = await SystemPermissionUserStore.CreateAsync(permissionUser, cancellationToken);

            await PermissionMonitor.OnPermissionChangedAsync(permissionUser.PermissionId);

            return(permissionUser);
        }
Exemple #2
0
        public async Task <TPermissionRole> CreateAsync(TPermissionRole permissionRole, CancellationToken cancellationToken)
        {
            permissionRole = await SystemPermissionRoleStore.CreateAsync(permissionRole, cancellationToken);

            await PermissionMonitor.OnPermissionChangedAsync(permissionRole.PermissionId);

            return(permissionRole);
        }
Exemple #3
0
        public override async Task <TPermission> UpdateAsync(TPermission entity, CancellationToken cancellationToken)
        {
            TPermission permission = await Store.FindByIdAsync(entity.Id, cancellationToken);

            if (permission == null)
            {
                throw new Exception($"id为:{entity.Id} 的权限设置不存在!");
            }
            entity = await base.UpdateAsync(entity, cancellationToken);

            if (entity.AllowedAllRoles != permission.AllowedAllRoles ||
                entity.AllowedAnonymous != permission.AllowedAnonymous ||
                entity.DeniedAll != permission.DeniedAll)
            {
                await PermissionMonitor.OnPermissionChangedAsync(entity.Id);
            }
            return(entity);
        }