public GetAllDataIds ( IEnumerable |
||
subjectIds | IEnumerable |
|
entityId | long | |
rightTypes | List |
|
return | IQueryable |
public List<ListViewItem> LoadDatasetVersionViewList( DataStructureType dataStructureType) { PermissionManager permissionManager = new PermissionManager(); SubjectManager subjectManager = new SubjectManager(); // add security ICollection<long> datasetIDs = permissionManager.GetAllDataIds(subjectManager.GetUserByName(GetUsernameOrDefault()).Id, 1, RightType.Update).ToList(); DataStructureManager dataStructureManager = new DataStructureManager(); DatasetManager dm = new DatasetManager(); Dictionary<long, XmlDocument> dmtemp = new Dictionary<long, XmlDocument>(); dmtemp = dm.GetDatasetLatestMetadataVersions(); List<ListViewItem> temp = new List<ListViewItem>(); if (dataStructureType.Equals(DataStructureType.Structured)) { List<StructuredDataStructure> list = dataStructureManager.StructuredDataStructureRepo.Get().ToList(); foreach (StructuredDataStructure sds in list) { sds.Materialize(); foreach (Dataset d in sds.Datasets) { if (dm.IsDatasetCheckedIn(d.Id)) { if (datasetIDs.Contains(d.Id)) { temp.Add(new ListViewItem(d.Id, XmlDatasetHelper.GetInformation(dm.GetDatasetLatestVersion(d), NameAttributeValues.title))); } } } } } else { List<UnStructuredDataStructure> list = dataStructureManager.UnStructuredDataStructureRepo.Get().ToList(); foreach (UnStructuredDataStructure sds in list) { foreach (Dataset d in sds.Datasets) { if (datasetIDs.Contains(d.Id)) { if (dm.IsDatasetCheckedIn(d.Id)) { DatasetVersion datasetVersion = dm.GetDatasetLatestVersion(d); temp.Add(new ListViewItem(d.Id, XmlDatasetHelper.GetInformation(datasetVersion, NameAttributeValues.title))); } } } } } return temp.OrderBy(p => p.Title).ToList(); }
/// <summary> /// Lists all exisiting datasets alongside with their current status /// </summary> /// <returns></returns> public ActionResult List() { ViewBag.Title = PresentationModel.GetViewTitleForTenant("Maintain Datasets", this.Session.GetTenant()); DatasetManager dm = new DatasetManager(); PermissionManager permissionManager = new PermissionManager(); SubjectManager subjectManager = new SubjectManager(); User user = subjectManager.GetUserByName(HttpContext.User.Identity.Name); List<Dataset> datasets = dm.DatasetRepo.Query().OrderBy(p=>p.Id).ToList(); List<long> datasetIds = new List<long>(); if (user != null) { datasetIds.AddRange(permissionManager.GetAllDataIds(user.Id, 1, RightType.Delete)); } ViewData["DatasetIds"] = datasetIds; return View(datasets); }
public List<ListViewItem> LoadDatasetViewList() { PermissionManager pm = new PermissionManager(); SubjectManager subjectManager = new SubjectManager(); DatasetManager datasetManager = new DatasetManager(); List<ListViewItem> temp = new List<ListViewItem>(); //get all datasetsid where the current userer has access to long userid = -1; if (subjectManager.ExistsUsername(GetUsernameOrDefault())) userid = subjectManager.GetUserByName(GetUsernameOrDefault()).Id; if (userid != -1) { foreach (long id in pm.GetAllDataIds(userid, 1, RightType.Update)) { if (datasetManager.IsDatasetCheckedIn(id)) { string title = XmlDatasetHelper.GetInformation(id, NameAttributeValues.title); string description = XmlDatasetHelper.GetInformation(id, NameAttributeValues.description); temp.Add(new ListViewItem(id, title, description)); } } } return temp.OrderBy(p => p.Title).ToList(); }