示例#1
0
            public async Task <bool> Handle(Command request, CancellationToken cancellationToken)
            {
                if (!(await _authorizationService.AuthorizeAsync(_user, null, new FullRightsRequirement())).Succeeded)
                {
                    throw new ForbiddenException();
                }

                if (request.Enabled)
                {
                    _lockService.EnableWorkspaceLocking();
                }
                else
                {
                    _lockService.DisableWorkspaceLocking();
                }

                var lockingEnabled = _lockService.IsWorkspaceLockingEnabled();
                await _mediator.Publish(new WorkspaceSettingsUpdated(lockingEnabled));

                return(lockingEnabled);
            }