Beispiel #1
0
		public DocumentUserType AddOrderDocument(int orderId, Guid fileId, int documentType, string documentDescription)
		{
			var appraiserRoles = new RoleType[] { RoleType.Appraiser, RoleType.CompanyAdminAndAppraiser, RoleType.AppraisalCompanyAdmin };
			var user = _securityContext.CurrentUser;
			DocumentUserType userType;
			if (appraiserRoles.Contains(user.PrimaryRole.RoleType) || documentType == (int)DocumentType.AppraisalReportPDF || documentType == (int)DocumentType.AppraisalReportReviewPDF ||
				documentType == (int)DocumentType.ACIXML)
				userType = DocumentUserType.Appraisal;
			else userType = DocumentUserType.Lender;

			_orderHistoryManager.AddDocumentUploadedNote(orderId, documentType, documentDescription);

			OrderDocumentInfo orderDocumentInfo = new OrderDocumentInfo() { DocumentDescription = documentDescription, DocumentTypeId = documentType, FileId = fileId, UserType = userType, OrderId = orderId };

			_orderDocumentsRepository.Add(orderDocumentInfo);

			return userType;
		}
 private bool UserAuthorizedToAccessEnvironment(UnitOfWork unitOfWork, long userId, string environment,
     RoleType[] roleTypes)
 {
     return
         unitOfWork.Context.Environments.Any(
             x =>
                 x.EnvironmentName == environment &&
                 x.Suite.SuiteUsers.Any(y => y.UserId == userId && roleTypes.Contains((RoleType) y.Role.RoleId)));
 }
 private bool UserAuthorizedToAccessParameter(UnitOfWork unitOfWork, long userId, string parameter,
     RoleType[] roleTypes)
 {
     return
         unitOfWork.Context.Parameters.Any(
             x =>
                 x.ParameterName == parameter &&
                 x.Suite.SuiteUsers.Any(y => y.UserId == userId && roleTypes.Contains((RoleType) y.Role.RoleId)));
 }
 private bool UserAuthorizedToAccessServer(UnitOfWork unitOfWork, long userId, long serverId,
     RoleType[] roleTypes)
 {
     return
         unitOfWork.Context.Servers.Any(
             x =>
                 x.ServerId == serverId &&
                 x.Suite.SuiteUsers.Any(y => y.UserId == userId && roleTypes.Contains((RoleType) y.Role.RoleId)));
 }
 private bool UserAuthorizedToAccessRegion(UnitOfWork unitOfWork, long userId, string region,
     RoleType[] roleTypes)
 {
     return
         unitOfWork.Context.Regions.Any(
             x =>
                 x.RegionName == region &&
                 x.Suite.SuiteUsers.Any(y => y.UserId == userId && roleTypes.Contains((RoleType) y.Role.RoleId)));
 }
 public bool UserAuthorizedToAccessApplication(UnitOfWork unitOfWork, long userId, string applicationName,
     RoleType[] roleTypes)
 {
     return
         unitOfWork.Context.Applications.Any(
             x =>
                 x.ApplicationName == applicationName &&
                 x.Suite.SuiteUsers.Any(y => y.UserId == userId && roleTypes.Contains((RoleType) y.Role.RoleId)));
 }
 private bool UserAuthorizedToAccessSuite(UnitOfWork unitOfWork, long loggedInUserId, string suiteName,
     RoleType[] roleTypes)
 {
     return
         unitOfWork.Context.SuiteUsers.Any(
             x =>
                 x.UserId == loggedInUserId && x.Suite.SuiteName == suiteName &&
                 roleTypes.Contains((RoleType) x.Role.RoleId));
 }