public DeleteAccountService(IEntityRepository <AccountDelete> accountDeleteRepository, IEntityRepository <User> userRepository, IEntityRepository <Scope> scopeRepository, IEntitiesContext entitiesContext, IPackageService packageService, IPackageOwnershipManagementService packageOwnershipManagementService, IReservedNamespaceService reservedNamespaceService, ISecurityPolicyService securityPolicyService, AuthenticationService authService, ISupportRequestService supportRequestService, IAuditingService auditingService, ITelemetryService telemetryService ) { _accountDeleteRepository = accountDeleteRepository ?? throw new ArgumentNullException(nameof(accountDeleteRepository)); _userRepository = userRepository ?? throw new ArgumentNullException(nameof(userRepository)); _scopeRepository = scopeRepository ?? throw new ArgumentNullException(nameof(scopeRepository)); _entitiesContext = entitiesContext ?? throw new ArgumentNullException(nameof(entitiesContext)); _packageService = packageService ?? throw new ArgumentNullException(nameof(packageService)); _packageOwnershipManagementService = packageOwnershipManagementService ?? throw new ArgumentNullException(nameof(packageOwnershipManagementService)); _reservedNamespaceService = reservedNamespaceService ?? throw new ArgumentNullException(nameof(reservedNamespaceService)); _securityPolicyService = securityPolicyService ?? throw new ArgumentNullException(nameof(securityPolicyService)); _authService = authService ?? throw new ArgumentNullException(nameof(authService)); _supportRequestService = supportRequestService ?? throw new ArgumentNullException(nameof(supportRequestService)); _auditingService = auditingService ?? throw new ArgumentNullException(nameof(auditingService)); _telemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService)); }
private static PackageSecurityPolicyEvaluationContext CreateTestContext( bool microsoftUserExists, IEnumerable <UserSecurityPolicy> policies, Package package, bool packageRegistrationAlreadyExists, IPackageOwnershipManagementService packageOwnershipManagementService = null, IReservedNamespaceService reservedNamespaceService = null) { var userService = new Mock <IUserService>(MockBehavior.Strict); if (microsoftUserExists) { userService .Setup(m => m.FindByUsername(MicrosoftTeamSubscription.MicrosoftUsername, false)) .Returns(Fakes.RequiredCoOwner); } else { userService .Setup(m => m.FindByUsername(MicrosoftTeamSubscription.MicrosoftUsername, false)) .Returns((User)null); } packageOwnershipManagementService = packageOwnershipManagementService ?? new Mock <IPackageOwnershipManagementService>(MockBehavior.Strict).Object; var context = new PackageSecurityPolicyEvaluationContext( userService.Object, packageOwnershipManagementService, policies, package, It.IsAny <HttpContextBase>()); return(context); }
public PackageSecurityPolicyEvaluationContext( IUserService userService, IPackageOwnershipManagementService packageOwnershipManagementService, IEnumerable <UserSecurityPolicy> policies, Package package, HttpContextBase httpContext) : base(policies, httpContext) { Package = package ?? throw new ArgumentNullException(nameof(package)); UserService = userService ?? throw new ArgumentNullException(nameof(userService)); PackageOwnershipManagementService = packageOwnershipManagementService ?? throw new ArgumentNullException(nameof(packageOwnershipManagementService)); }
public JsonApiController( IPackageService packageService, IUserService userService, IMessageService messageService, IAppConfiguration appConfiguration, IPackageOwnershipManagementService packageOwnershipManagementService) { _packageService = packageService ?? throw new ArgumentNullException(nameof(packageService)); _userService = userService ?? throw new ArgumentNullException(nameof(userService)); _messageService = messageService ?? throw new ArgumentNullException(nameof(messageService)); _appConfiguration = appConfiguration ?? throw new ArgumentNullException(nameof(appConfiguration)); _packageOwnershipManagementService = packageOwnershipManagementService ?? throw new ArgumentNullException(nameof(packageOwnershipManagementService)); }
public JsonApiController( IPackageService packageService, IUserService userService, IMessageService messageService, IAppConfiguration appConfiguration, ISecurityPolicyService policyService, IPackageOwnershipManagementService packageOwnershipManagementService) { _packageService = packageService; _userService = userService; _messageService = messageService; _appConfiguration = appConfiguration; _policyService = policyService; _packageOwnershipManagementService = packageOwnershipManagementService; }
public PackageSecurityPolicyEvaluationContext( IUserService userService, IPackageOwnershipManagementService packageOwnershipManagementService, ITelemetryService telemetryService, IEnumerable <UserSecurityPolicy> policies, Package package, User sourceAccount, User targetAccount, HttpContextBase httpContext = null) : base(policies, sourceAccount, targetAccount, httpContext) { Package = package ?? throw new ArgumentNullException(nameof(package)); UserService = userService ?? throw new ArgumentNullException(nameof(userService)); TelemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService)); PackageOwnershipManagementService = packageOwnershipManagementService ?? throw new ArgumentNullException(nameof(packageOwnershipManagementService)); }