public InspectionResult InspectQuery(EntityQuery2 query) { if (query.IsForEntity(Notification.ENTITY)) { var relToSender = query.GetRelatedQuery(User.ENTITY, Roles.Sender); if (relToSender != null) { var id = relToSender.GetSingleId(); if (id.HasValue && id.Value == _securityService.CurrentUser.Id) { return(InspectionResult.Allow); } } var relToRecipient = query.GetRelatedQuery(User.ENTITY, Roles.Recipient); if (relToRecipient != null) { var id = relToRecipient.GetSingleId(); if (id.HasValue && id.Value == _securityService.CurrentUser.Id) { return(InspectionResult.Allow); } } if (relToRecipient == null) { query.Include(User.ENTITY, Roles.Recipient); } if (relToSender != null) { query.Include(User.ENTITY, Roles.Sender); } } return(InspectionResult.None); }
public InspectionResult InspectQuery(EntityQuery2 query) { if (query.IsForEntity("Arguments") && _securityService.HasModulePermission(_securityService.CurrentUser, BiblRefModule.Id, Permissions.Use)) { return(InspectionResult.Allow); } if (query.IsForEntity(EntityConsts.BibliographicDocument) || query.IsForEntity(EntityConsts.BibliographicQuery) || query.IsForEntity(EntityConsts.Bibliography) || query.IsForEntity(EntityConsts.Language)) { if (_securityService.HasModulePermission(_securityService.CurrentUser, BiblRefModule.Id, Permissions.Use)) { if (_securityService.CurrentUser.UserType == UserTypes.Librarian) { return(InspectionResult.Allow); } else if (_securityService.CurrentUser.UserType == UserTypes.Customer && query.IsForEntity(EntityConsts.BibliographicQuery)) { var relToMe = query.GetRelatedQuery(User.ENTITY, Roles.Customer); if (relToMe != null && relToMe.GetSingleId().HasValue&& relToMe.GetSingleId().Value == _securityService.CurrentUser.Id) { return(InspectionResult.Allow); } else if (!query.HasInclude(User.ENTITY, Roles.Customer)) { query.Include(User.ENTITY, Roles.Customer); } } else { return(InspectionResult.Allow); } } } else if (query.IsForEntity(Payment.ENTITY) && _securityService.CurrentUser.UserType == UserTypes.Librarian && _securityService.HasModulePermission(_securityService.CurrentUser, BiblRefModule.Id, Permissions.Use)) { if (query.GetRelatedQuery(EntityConsts.BibliographicQuery, Roles.Payment) != null) { return(InspectionResult.Allow); } else if (!query.HasInclude(EntityConsts.BibliographicQuery, Roles.Payment)) { query.Include(EntityConsts.BibliographicQuery, Roles.Payment); } } return(InspectionResult.None); }
public InspectionResult InspectQuery(EntityQuery2 query) { if (query.IsForEntity("Arguments") && _securityService.HasModulePermission(_securityService.CurrentUser, AskTheLibModule.Id, Permissions.Use)) { return(InspectionResult.Allow); } else if (query.IsForEntity(Inquery.EntityType)) { if (_securityService.HasModulePermission(_securityService.CurrentUser, AskTheLibModule.Id, Permissions.Use)) { if (_securityService.CurrentUser.UserType == UserTypes.Librarian) { return(InspectionResult.Allow); } else if (_securityService.CurrentUser.UserType == UserTypes.Customer) { var relTo = query.GetRelatedQuery(User.ENTITY, RelationConsts.Customer); if (relTo != null && relTo.GetSingleId().HasValue&& relTo.GetSingleId().Value == _securityService.CurrentUser.Id) { return(InspectionResult.Allow); } else if (!query.HasInclude(User.ENTITY, RelationConsts.Customer)) { query.Include(User.ENTITY, RelationConsts.Customer); } } } } else if (query.IsForEntity(User.ENTITY)) { if (_securityService.HasModulePermission(_securityService.CurrentUser, AskTheLibModule.Id, Permissions.Use) && _securityService.CurrentUser.UserType == UserTypes.Librarian) { return(InspectionResult.Allow); } } else if (query.IsForEntity(Notification.ENTITY) && _securityService.CurrentUser.UserType == UserTypes.Librarian && _securityService.HasModulePermission(_securityService.CurrentUser, AskTheLibModule.Id, Permissions.Use) && query.GetRelatedQuery(Inquery.EntityType, RelationConsts.Inquery) != null) { return(InspectionResult.Allow); } return(InspectionResult.None); }
public InspectionResult InspectQuery(EntityQuery2 query) { if (query.IsForEntity("Arguments") && _securityService.HasModulePermission(_securityService.CurrentUser, AskTheLibModule.Id, Permissions.Use)) return InspectionResult.Allow; else if (query.IsForEntity(Inquery.EntityType)) { if (_securityService.HasModulePermission(_securityService.CurrentUser, AskTheLibModule.Id, Permissions.Use)) { if (_securityService.CurrentUser.UserType == UserTypes.Librarian) return InspectionResult.Allow; else if (_securityService.CurrentUser.UserType == UserTypes.Customer) { var relTo = query.GetRelatedQuery(User.ENTITY, RelationConsts.Customer); if (relTo != null && relTo.GetSingleId().HasValue && relTo.GetSingleId().Value == _securityService.CurrentUser.Id) return InspectionResult.Allow; else if (!query.HasInclude(User.ENTITY, RelationConsts.Customer)) query.Include(User.ENTITY, RelationConsts.Customer); } } } else if (query.IsForEntity(User.ENTITY)) { if (_securityService.HasModulePermission(_securityService.CurrentUser, AskTheLibModule.Id, Permissions.Use) && _securityService.CurrentUser.UserType == UserTypes.Librarian) { return InspectionResult.Allow; } } else if (query.IsForEntity(Notification.ENTITY) && _securityService.CurrentUser.UserType == UserTypes.Librarian && _securityService.HasModulePermission(_securityService.CurrentUser, AskTheLibModule.Id, Permissions.Use) && query.GetRelatedQuery(Inquery.EntityType, RelationConsts.Inquery) != null) { return InspectionResult.Allow; } return InspectionResult.None; }
public InspectionResult InspectQuery(EntityQuery2 query) { if (query.IsForEntity(Payment.ENTITY)) { var cust = query.GetRelatedQuery(User.ENTITY, Payment.ROLE_CUSTOMER); if (cust != null && cust.GetSingleId().HasValue&& cust.GetSingleId().Value == _securityService.CurrentUser.Id) { return(InspectionResult.Allow); } else if (!query.HasInclude(User.ENTITY, Payment.ROLE_CUSTOMER)) { query.Include(User.ENTITY, Payment.ROLE_CUSTOMER); } } return(InspectionResult.None); }
public InspectionResult InspectQuery(EntityQuery2 query) { if (query.IsForEntity("Arguments") && _securityService.HasModulePermission(_securityService.CurrentUser, BiblListModule.Id, Permissions.Use)) return InspectionResult.Allow; if (query.IsForEntity(EntityConsts.BibliographicListQuery) || query.IsForEntity(EntityConsts.BibliographicListStandart)) { if (_securityService.HasModulePermission(_securityService.CurrentUser, BiblListModule.Id, Permissions.Use)) { if (_securityService.CurrentUser.UserType == UserTypes.Librarian) return InspectionResult.Allow; else if (_securityService.CurrentUser.UserType == UserTypes.Customer && query.IsForEntity(EntityConsts.BibliographicListQuery)) { var relToMe = query.GetRelatedQuery(User.ENTITY, Roles.Customer); if (relToMe != null && relToMe.GetSingleId().HasValue && relToMe.GetSingleId().Value == _securityService.CurrentUser.Id) return InspectionResult.Allow; else if (!query.HasInclude(User.ENTITY, Roles.Customer)) query.Include(User.ENTITY, Roles.Customer); } else return InspectionResult.Allow; } } else if (query.IsForEntity(Payment.ENTITY) && _securityService.CurrentUser.UserType == UserTypes.Librarian && _securityService.HasModulePermission(_securityService.CurrentUser, BiblListModule.Id, Permissions.Use)) { if (query.GetRelatedQuery(EntityConsts.BibliographicListQuery, Roles.Payment) != null) return InspectionResult.Allow; else if (!query.HasInclude(EntityConsts.BibliographicListQuery, Roles.Payment)) query.Include(EntityConsts.BibliographicListQuery, Roles.Payment); } return InspectionResult.None; }
public InspectionResult InspectQuery(EntityQuery2 query) { if (query.IsForEntity(Payment.ENTITY)) { var cust = query.GetRelatedQuery(User.ENTITY, Payment.ROLE_CUSTOMER); if (cust != null && cust.GetSingleId().HasValue && cust.GetSingleId().Value == _securityService.CurrentUser.Id) return InspectionResult.Allow; else if (!query.HasInclude(User.ENTITY, Payment.ROLE_CUSTOMER)) query.Include(User.ENTITY, Payment.ROLE_CUSTOMER); } return InspectionResult.None; }
public InspectionResult InspectQuery(EntityQuery2 query) { if (query.IsForEntity(Notification.ENTITY)) { var relToSender = query.GetRelatedQuery(User.ENTITY, Roles.Sender); if (relToSender != null) { var id = relToSender.GetSingleId(); if (id.HasValue && id.Value == _securityService.CurrentUser.Id) return InspectionResult.Allow; } var relToRecipient = query.GetRelatedQuery(User.ENTITY, Roles.Recipient); if (relToRecipient != null) { var id = relToRecipient.GetSingleId(); if (id.HasValue && id.Value == _securityService.CurrentUser.Id) return InspectionResult.Allow; } if (relToRecipient == null) { query.Include(User.ENTITY, Roles.Recipient); } if (relToSender != null) { query.Include(User.ENTITY, Roles.Sender); } } return InspectionResult.None; }