public static void update_index(Guid applicationId, SearchDocType type, int batchSize, int sleepInterval = 20000) { //Update Tags Before Index Update: Because tagextraction uses IndexLastUpdateDate field if (type == SearchDocType.Node) { CNController.update_form_and_wiki_tags(applicationId, batchSize); } List <SearchDoc> updateSdList = SearchController.get_index_queue_items(applicationId, batchSize, type); List <SearchDoc> deletedSdList = updateSdList.Where(u => u.Deleted == true).ToList(); List <Guid> IDs = updateSdList.Select(u => u.ID).ToList(); deletedSdList.ForEach(sd => updateSdList.Remove(sd)); SearchUtilities.remove_docs(applicationId, deletedSdList); if (!RaaiVanSettings.Solr.Enabled) { Thread.Sleep(sleepInterval); } SearchUtilities.update_index(applicationId, updateSdList); SearchController.set_index_last_update_date(applicationId, type, IDs); }
protected void get_expertise_domains(Guid userId, ref string responseText) { if (!paramsContainer.GBView) { return; } NodeType nodeType = CNController.get_node_type(paramsContainer.Tenant.Id, NodeTypes.Expertise); if (nodeType == null) { return; } List <Expert> domains = CNController.get_expertise_domains(paramsContainer.Tenant.Id, userId, null, null, true, nodeType.NodeTypeID.Value); responseText = "{\"Nodes\":["; bool isFirst = true; foreach (Expert ex in domains) { responseText += (isFirst ? string.Empty : ",") + "{\"NodeID\":\"" + ex.Node.NodeID.Value.ToString() + "\",\"NodeName\":\"" + Base64.encode(ex.Node.Name) + "\",\"ReferralsCount\":\"" + (ex.ReferralsCount.HasValue ? ex.ReferralsCount : 0).ToString() + "\",\"ConfirmsPercentage\":\"" + (ex.ConfirmsPercentage.HasValue ? ex.ConfirmsPercentage : 0).ToString() + "\"}"; isFirst = false; } responseText += "]}"; }
public bool AddMember(string nodeId, string nodeTypeId, string username) { ITenant tenant = HttpContext.Current.GetCurrentTenant(); if (tenant == null) { return(false); } Guid?userId = UsersController.get_user_id(tenant.Id, username); Guid nId = CNController.get_node_id(tenant.Id, nodeId, nodeTypeId); NodeMember nm = new NodeMember(); nm.Node.NodeID = nId; nm.Member.UserID = userId; nm.MembershipDate = DateTime.Now; nm.AcceptionDate = DateTime.Now; List <Dashboard> retDashboards = new List <Dashboard>(); bool result = userId.HasValue && CNController.add_member(tenant.Id, nm, ref retDashboards); if (result) { NotificationController.transfer_dashboards(tenant.Id, retDashboards); } return(result); }
protected void get_sitemap_index(int?count) { if (!count.HasValue) { count = 1000; } long nodesCount = CNController.get_nodes_count(paramsContainer.Tenant.Id) .Sum(u => u.Count.HasValue ? u.Count.Value : 0); double pagesCount = Math.Ceiling((double)nodesCount / (double)count); string response = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<sitemapindex xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">"; for (int i = 0; i < pagesCount; ++i) { response += "<sitemap>" + "<loc>" + PublicConsts.get_complete_url(paramsContainer.Tenant.Id, PublicConsts.RSSPage) + "/node?" + ("Sitemap=true&LowerBoundary=" + ((count * i) + 1).ToString() + "&Count=" + count.ToString()).Replace("&", "&") + "</loc>" + "<lastmod>" + String.Format("{0:yyyy-MM-dd}", DateTime.Now) + "</lastmod>" + "</sitemap>"; } response += "</sitemapindex>"; paramsContainer.xml_response(response); }
private static Dictionary <SearchDocType, List <Guid> > get_existing_ids(Guid applicationId, List <SearchDoc> docs, ref List <DocFileInfo> files) { Dictionary <SearchDocType, List <Guid> > ids = new Dictionary <SearchDocType, List <Guid> >(); ids[SearchDocType.Node] = CNController.get_existing_node_ids(applicationId, docs.Where(u => u.SearchDocType == SearchDocType.Node).Select(v => v.ID).ToList(), true, false); ids[SearchDocType.NodeType] = CNController.get_existing_node_type_ids(applicationId, docs.Where(u => u.SearchDocType == SearchDocType.NodeType).Select(v => v.ID).ToList(), false); ids[SearchDocType.Question] = QAController.get_existing_question_ids(applicationId, docs.Where(u => u.SearchDocType == SearchDocType.Question).Select(v => v.ID).ToList()); ids[SearchDocType.User] = UsersController.get_approved_user_ids(applicationId, docs.Where(u => u.SearchDocType == SearchDocType.User).Select(v => v.ID).ToList()); //Files List <DocFileInfo> newFiles = DocumentsController.get_file_owner_nodes(applicationId, docs.Where(u => u.SearchDocType == SearchDocType.File).Select(v => v.ID).ToList()) .Where(u => u.FileID.HasValue).ToList(); ids[SearchDocType.File] = newFiles.Select(v => v.FileID.Value).ToList(); foreach (DocFileInfo f in newFiles) { if (!files.Any(u => u.FileID == f.FileID)) { files.Add(f); } } //end of Files return(ids); }
private static void update_index(Guid applicationId, SearchDocType docType) { List <SearchDoc> docs = new List <SearchDoc>(); _remove_all_docs(applicationId); if (docType == SearchDocType.Node) { List <Node> nodes = CNController.get_nodes(applicationId, searchText: null, isDocument: null, isKnowledge: null); foreach (Node nd in nodes) { docs.Add(new SearchDoc() { ID = nd.NodeID.Value, AdditionalID = nd.AdditionalID, Title = nd.Name, Description = nd.Description, Type = SearchDocType.Node.ToString() }); } } _create_index(applicationId, docs); }
protected void Page_Load(object sender, EventArgs e) { paramsContainer = new ParamsContainer(HttpContext.Current); initialJson.Value = PublicMethods.toJSON(RouteList.get_data_server_side(paramsContainer, RouteName.node)); try { Guid?nodeId = PublicMethods.parse_guid(Request.Params["ID"], alternatvieValue: PublicMethods.parse_guid(Request.Params["NodeID"])); if (Request.Url.ToString().ToLower().Contains("_escaped_fragment_=") && nodeId.HasValue) { ParamsContainer paramsContainer = new ParamsContainer(HttpContext.Current); Modules.CoreNetwork.Node _nd = CNController.get_node(paramsContainer.Tenant.Id, nodeId.Value, true); string htmlContent = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" + "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>" + _nd.Name + " - " + RaaiVanSettings.SystemTitle(paramsContainer.Tenant.Id) + "</title></head><body>" + "<div>" + _nd.Name + "</div>" + "<div>" + ProviderUtil.list_to_string <string>(_nd.Tags, ' ') + "</div>" + "<div>" + PublicMethods.shuffle_text(PublicMethods.markup2plaintext(paramsContainer.Tenant.Id, _nd.Description, true)) + "</div>" + "<div>" + PublicMethods.markup2plaintext(paramsContainer.Tenant.Id, Modules.Wiki.WikiController.get_wiki_content(paramsContainer.Tenant.Id, nodeId.Value), true) + "</div>" + "</body></html>"; paramsContainer.return_response(htmlContent); return; } } catch { } }
private void PackingTest_Load(object sender, EventArgs e) { CNController.CNC_Init(); _CodeBase = _CodeBase.Replace("/", "\\"); if (!_CodeBase.EndsWith("\\")) { _CodeBase += "\\"; } treeViewTasks.LabelEdit = false; treeViewTasks.ImageList = imageListStatus; for (int i = 0; i < treeViewTasks.ImageList.Images.Count; i++) { if (treeViewTasks.ImageList.Images.Keys[i].Equals("StatusAnnotations_Complete_and_ok_16xLG_color.png", StringComparison.InvariantCultureIgnoreCase)) { _goodIconIndex = i; } else if (treeViewTasks.ImageList.Images.Keys[i].Equals("StatusAnnotations_Critical_16xLG_color.png", StringComparison.InvariantCultureIgnoreCase)) { _badIconIndex = i; } } tabControlTask.TabPages.Clear(); RefreshTaskTree(); WindowState = FormWindowState.Maximized; }
public bool AddNode(string nodeId, string nodeTypeId, string name, string description = null, string parentNodeId = null) { ITenant tenant = HttpContext.Current.GetCurrentTenant(); if (tenant == null) { return(false); } Node node = new Node() { NodeID = Guid.NewGuid(), AdditionalID = nodeId, Name = name, Description = description, CreationDate = DateTime.Now }; if (!string.IsNullOrEmpty(parentNodeId)) { node.ParentNodeID = CNController.get_node_id(tenant.Id, parentNodeId, nodeTypeId); } return(CNController.add_node(tenant.Id, node, nodeTypeId)); }
protected void unset_confidentiality_level(Guid?objectId, ref string responseText) { //Privacy Check: OK if (!paramsContainer.GBEdit) { return; } bool isNode = objectId.HasValue && CNController.is_node(paramsContainer.Tenant.Id, objectId.Value); bool isUser = !isNode; bool accessDenied = false; if (isUser) { accessDenied = !objectId.HasValue || !AuthorizationManager.has_right(AccessRoleName.ManageConfidentialityLevels, paramsContainer.CurrentUserID); } else { accessDenied = !objectId.HasValue || ( !PublicMethods.is_system_admin(paramsContainer.Tenant.Id, paramsContainer.CurrentUserID.Value) && !CNController.is_service_admin(paramsContainer.Tenant.Id, objectId.Value, paramsContainer.CurrentUserID.Value) && !CNController.is_node_admin(paramsContainer.Tenant.Id, paramsContainer.CurrentUserID.Value, objectId.Value, null, null, null)); } if (accessDenied) { responseText = "{\"ErrorText\":\"" + Messages.AccessDenied + "\"}"; if (objectId.HasValue) { _save_error_log(Modules.Log.Action.UnsetConfidentialityLevel_PermissionFailed, objectId); } return; } bool succeed = objectId.HasValue && PrivacyController.unset_confidentiality_level(paramsContainer.Tenant.Id, objectId.Value, paramsContainer.CurrentUserID.Value); responseText = succeed ? "{\"Succeed\":\"" + Messages.OperationCompletedSuccessfully + "\"}" : "{\"ErrorText\":\"" + Messages.OperationFailed + "\"}"; //Save Log if (succeed) { LogController.save_log(paramsContainer.Tenant.Id, new Log() { UserID = paramsContainer.CurrentUserID.Value, Date = DateTime.Now, HostAddress = PublicMethods.get_client_ip(HttpContext.Current), HostName = PublicMethods.get_client_host_name(HttpContext.Current), Action = Modules.Log.Action.UnsetConfidentialityLevel, SubjectID = objectId, ModuleIdentifier = ModuleIdentifier.PRVC }); } //end of Save Log }
protected static string get_deleted_states(Guid applicationId, int?count, long?lowerBoundary) { List <DeletedState> deletedStates = GlobalController.get_deleted_states(applicationId, count, lowerBoundary); string response = "{\"FirstID\":" + (deletedStates.Count > 0 ? deletedStates.First().ID.Value : 0).ToString() + ",\"LastID\":" + (deletedStates.Count > 0 ? deletedStates.Last().ID.Value : 0).ToString() + ",\"Items\":["; List <Guid> nodeIds = new List <Guid>(); bool isFirst = true; foreach (DeletedState ds in deletedStates) { if (ds.ObjectType == "EmailAddress") { continue; } if (ds.ObjectType == "Node") { nodeIds.Add(ds.ObjectID.Value); } bool isRelation = ds.RelSourceID.HasValue && ds.RelDestinationID.HasValue; response += (isFirst ? string.Empty : ",") + _get_deleted_state_json(ds.ObjectID.Value.ToString(), ds.ObjectType, ds.Date, ds.Deleted, isRelation, ds.RelSourceID, ds.RelSourceType, ds.RelDestinationID, ds.RelDestinationType, ds.Bidirectional.HasValue && ds.Bidirectional.Value, ds.HasReverse.HasValue && ds.HasReverse.Value); if (ds.ObjectType == "TaggedItem" && isRelation && ds.RelCreatorID.HasValue) { _get_deleted_state_json(Guid.NewGuid().ToString(), "UsedAsTag", ds.Date, false, true, ds.RelCreatorID, "User", ds.RelDestinationID, ds.RelDestinationType, false, true); } isFirst = false; } if (nodeIds.Count > 0) { List <Node> nodes = CNController.get_nodes(applicationId, nodeIds, full: null, currentUserId: null); foreach (Node nd in nodes) { response += (isFirst ? string.Empty : ",") + _get_deleted_state_json(Guid.NewGuid().ToString(), "IsA", nd.CreationDate, false, true, nd.NodeID.Value, "Node", nd.NodeTypeID.Value, "NodeType", false, true); isFirst = false; } } //end of 'if(nodeIds.Count > 0)' return(response + "]}"); }
private void _rss_to_nodes(object obj) { List <Modules.CoreNetwork.Node> nodes = (List <Modules.CoreNetwork.Node>)obj; foreach (Modules.CoreNetwork.Node nd in nodes) { CNController.add_node(paramsContainer.Tenant.Id, nd); } }
protected void nodes_rss(Guid?nodeTypeId, string title, string description, int?count, long?lowerBoundary, string searchText, bool?isDocument, bool?isKnowledge, bool?sitemap) { if (!count.HasValue || count.Value <= 0) { count = 20; } if (count.HasValue && count > 5000) { count = 5000; } List <Node> nodes = nodeTypeId.HasValue ? CNController.get_nodes(paramsContainer.Tenant.Id, nodeTypeId.Value, null, searchText, isDocument, isKnowledge, null, null, count.Value, lowerBoundary, false) : CNController.get_nodes(paramsContainer.Tenant.Id, searchText, isDocument, isKnowledge, null, null, count.Value, lowerBoundary, false); if (sitemap.HasValue && sitemap.Value) { paramsContainer.xml_response( "<?xml version=\"1.0\" encoding=\"UTF-8\" ?><urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">" + ProviderUtil.list_to_string <string>(nodes.Select( u => "<url>" + "<loc>" + PublicConsts.get_complete_url(paramsContainer.Tenant.Id, PublicConsts.NodePage) + "/" + u.NodeID.Value.ToString() + "</loc>" + "<changefreq>weekly</changefreq>" + "<lastmod>" + String.Format("{0:yyyy-MM-dd}", DateTime.Now) + "</lastmod>" + //"<priority>0.8</priority>" + "</url>").ToList(), null) + "</urlset>" ); return; } List <RSSItem> rssItems = new List <RSSItem>(); foreach (Modules.CoreNetwork.Node _nd in nodes) { rssItems.Add(new RSSItem() { Title = _nd.Name, Link = PublicConsts.get_complete_url(paramsContainer.Tenant.Id, PublicConsts.NodePage) + "/" + _nd.NodeID.Value.ToString() }); } RSSUtilities.send_feed(HttpContext.Current, rssItems, title, description); }
protected void i_am_not_expert(Guid nodeId, ref string responseText) { if (!paramsContainer.GBEdit) { return; } bool result = CNController.i_am_not_expert(paramsContainer.Tenant.Id, paramsContainer.CurrentUserID.Value, nodeId); responseText = result ? "{\"Succeed\":\"" + Messages.OperationCompletedSuccessfully + "\"}" : "{\"ErrorText\":\"" + Messages.OperationFailed + "\"}"; }
protected void search_expertise_domains(string searchText, int count, ref string responseText) { if (!paramsContainer.GBView) { return; } List <Node> nodes = CNController.get_nodes(paramsContainer.Tenant.Id, NodeTypes.Expertise, searchText, null, null, null, null, count, null, false, null); responseText = "{\"Nodes\":[" + "" + string.Join(",", nodes.Select( nd => "{\"NodeID\":\"" + nd.NodeID.Value.ToString() + "\",\"Name\":\"" + Base64.encode(nd.Name) + "\"}")) + "]}"; }
public bool UnsetAdmin(string nodeId, string nodeTypeId, string username) { ITenant tenant = HttpContext.Current.GetCurrentTenant(); if (tenant == null) { return(false); } Guid?userId = UsersController.get_user_id(tenant.Id, username); return(userId.HasValue && CNController.set_unset_node_admin(tenant.Id, CNController.get_node_id(tenant.Id, nodeId, nodeTypeId), userId.Value, false)); }
public bool RemoveMember(string nodeId, string nodeTypeId, string username) { ITenant tenant = HttpContext.Current.GetCurrentTenant(); if (tenant == null) { return(false); } Guid?userId = UsersController.get_user_id(tenant.Id, username); return(userId.HasValue && CNController.remove_member(tenant.Id, CNController.get_node_id(tenant.Id, nodeId, nodeTypeId), userId.Value)); }
protected void i_am_expert(string expertiseDomain, ref string responseText) { if (!paramsContainer.GBEdit) { return; } Guid?result = CNController.i_am_expert(paramsContainer.Tenant.Id, paramsContainer.CurrentUserID.Value, expertiseDomain); responseText = result.HasValue ? "{\"Succeed\":\"" + Messages.OperationCompletedSuccessfully + "\",\"NodeID\":\"" + result.ToString() + "\",\"ReferralsCount\":\"" + CNController.get_referrals_count(paramsContainer.Tenant.Id, paramsContainer.CurrentUserID.Value, result.Value).ToString() + "\"}" : "{\"ErrorText\":\"" + Messages.OperationFailed + "\"}"; }
public bool ModifyNode(string nodeId, string nodeTypeId, string name, string description) { ITenant tenant = HttpContext.Current.GetCurrentTenant(); if (tenant == null) { return(false); } Node node = new Node() { NodeID = CNController.get_node_id(tenant.Id, nodeId, nodeTypeId), Name = name, Description = description, LastModificationDate = DateTime.Now }; return(CNController.modify_node(tenant.Id, node)); }
protected bool update_node_ids(ref XmlDocument doc) { if (!paramsContainer.GBEdit) { return(false); } string nodeType = PublicMethods.verify_string(doc.DocumentElement.Attributes["nodetype"].Value); Guid?nodeTypeId = CNController.get_node_type_id(paramsContainer.Tenant.Id, nodeType); if (!nodeTypeId.HasValue) { return(false); } List <KeyValuePair <string, string> > exNodes = new List <KeyValuePair <string, string> >(); XmlNodeList nodes = doc.GetElementsByTagName("Node"); foreach (XmlNode _nd in nodes) { string id = _nd.Attributes["id"] == null || _nd.Attributes["id"].ToString() == string.Empty ? null : PublicMethods.verify_string(_nd.Attributes["id"].Value.Trim()); string newId = _nd.Attributes["newid"] == null || _nd.Attributes["newid"].ToString() == string.Empty ? null : PublicMethods.verify_string(_nd.Attributes["newid"].Value.Trim()); if (!string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(newId) && !exNodes.Any(n => n.Value == newId)) { exNodes.Add(new KeyValuePair <string, string>(id, newId)); } } bool result = true; PublicMethods.split_list <KeyValuePair <string, string> >(exNodes, 200, items => { result = DEController.update_node_ids(paramsContainer.Tenant.Id, paramsContainer.CurrentUserID.Value, nodeTypeId.Value, items); }); return(result); }
public bool AddNodeType(string nodeTypeId, string typeName, string description) { ITenant tenant = HttpContext.Current.GetCurrentTenant(); if (tenant == null) { return(false); } NodeType nt = new NodeType() { NodeTypeID = Guid.NewGuid(), NodeTypeAdditionalID = nodeTypeId, Name = typeName, Description = description, CreationDate = DateTime.Now }; return(CNController.add_node_type(tenant.Id, nt)); }
public bool MoveNode(string nodeId, string parentNodeId, string nodeTypeId) { ITenant tenant = HttpContext.Current.GetCurrentTenant(); if (tenant == null) { return(false); } Node node = new Node() { NodeID = CNController.get_node_id(tenant.Id, nodeId, nodeTypeId), ParentNodeID = CNController.get_node_id(tenant.Id, parentNodeId, nodeTypeId), LastModificationDate = DateTime.Now }; string errorMessage = string.Empty; return(CNController.set_direct_parent(tenant.Id, node.NodeID.Value, node.ParentNodeID, Guid.Empty, ref errorMessage)); }
private void buttonNew_Click(object sender, EventArgs e) { List <MDF> allMDF = null; string xmlResultFile = CNController.CADM_BinPacking(_cncConnector.GetModelName()); if (!String.IsNullOrEmpty(xmlResultFile)) { //System.Diagnostics.Process.Start(xmlResultFile); allMDF = BinPackingInfo.LoadFromXml(xmlResultFile); if (allMDF.Count > 0) { try { string taskName = GetTaskName(xmlResultFile); string sTaskFolder = String.Format("{0}PackingTasks\\", _CodeBase); string sTaskFile = String.Format("{0}PackingTasks\\{1}.xml", _CodeBase, taskName); if (!Directory.Exists(sTaskFolder)) { Directory.CreateDirectory(sTaskFolder); } int seq = 1; while (File.Exists(sTaskFile)) { sTaskFile = String.Format("{0}PackingTasks\\{1}-{2:000}.xml", _CodeBase, taskName, seq++); } File.Copy(xmlResultFile, sTaskFile); RefreshTaskTree(); } catch (Exception er) { } } } }
public static void GetRelatedNodes(Guid applicationId, ref List <Node> retNodes, Guid eventId, NodeTypes?nodeType) { string spName = GetFullyQualifiedName("GetRelatedNodeIDs"); try { string strNodeTypeId = null; if (nodeType.HasValue) { strNodeTypeId = CNUtilities.get_node_type_additional_id(nodeType.Value).ToString(); } List <Guid> nodeIds = new List <Guid>(); IDataReader reader = ProviderUtil.execute_reader(spName, applicationId, eventId, strNodeTypeId); ProviderUtil.parse_guids(ref reader, ref nodeIds); retNodes = CNController.get_nodes(applicationId, nodeIds, full: null, currentUserId: null); } catch (Exception ex) { LogController.save_error_log(applicationId, null, spName, ex, ModuleIdentifier.EVT); } }
public static List <Dashboard> send_dashboards(Guid applicationId, Guid?currentUserId, List <Dashboard> dashboards) { string username = "******"; string password = "******"; List <User> users = UsersController.get_users(applicationId, dashboards.Where(u => u.UserID.HasValue).Select(x => x.UserID.Value).ToList()); List <Node> nodes = CNController.get_nodes(applicationId, dashboards.Where(u => u.NodeID.HasValue).Select(x => x.NodeID.Value).ToList(), full: null); List <Dashboard> failed = new List <Dashboard>(); foreach (Dashboard d in dashboards) { if (!d.UserID.HasValue || d.Type != DashboardType.Knowledge || !users.Any(u => u.UserID == d.UserID) || !nodes.Any(u => u.NodeID == d.NodeID)) { continue; } User theUser = users.Where(u => u.UserID == d.UserID).FirstOrDefault(); Node theNode = nodes.Where(u => u.NodeID == d.NodeID).FirstOrDefault(); decimal nationalCode = 0; if (theUser == null || theNode == null || !decimal.TryParse(theUser.UserName, out nationalCode)) { continue; } string subject = string.Empty, message = string.Empty; switch (d.SubType) { case DashboardSubType.Admin: case DashboardSubType.ExpirationDate: case DashboardSubType.EvaluationRefused: case DashboardSubType.EvaluationDone: case DashboardSubType.Knowledgable: break; case DashboardSubType.Evaluator: subject = "ارجاع دانش جهت داوری"; message = "با سلام و احترام، " + "خبره گرامی، '" + theUser.FullName + "'، '" + theNode.NodeType + "' با عنوان '" + theNode.Name + "' و کد رهگیری '" + theNode.AdditionalID + "' جهت ارزیابی برای شما ارسال شده است. لطفا به کارتابل رای ون مراجعه فرمایید. " + "با تشکر، دبیرخانه مدیریت دانش، تلفن تماس: 83735503"; break; case DashboardSubType.Revision: subject = "ارجاع دانش جهت اصلاح"; message = "با سلام و احترام، " + "دانشکار گرامی، '" + theUser.FullName + "'، '" + theNode.NodeType + "' شما با عنوان '" + theNode.Name + "' و کد رهگیری '" + theNode.AdditionalID + "' جهت اصلاح به شما ارجاع داده شده است. لطفا به کارتابل رای ون مراجعه فرمایید. " + "با تشکر، دبیرخانه مدیریت دانش، تلفن تماس: 83735503"; break; default: break; } if (string.IsNullOrEmpty(subject) || string.IsNullOrEmpty(message)) { continue; } try { Barid.WebService.CreatePostItemService service = new Barid.WebService.CreatePostItemService(); service.Url = "http://10.110.11.12/SendPostItem/"; Barid.WebService.WebSendPostItemType result = service.SendPostItem(username, password, subject, message, new string[] { theUser.UserName }, new Barid.WebService.WebAttachment[] { }, 0, 0); if (string.IsNullOrEmpty(result.ToString()) || result.ToString().ToLower() != "sendsuccessful") { LogController.save_error_log(applicationId, currentUserId, "Gas_SendNotificationToBarid", "Username: "******", " + result.ToString(), ModuleIdentifier.Jobs); } } catch (Exception ex) { failed.Add(d); LogController.save_error_log(applicationId, currentUserId, "Gas_SendNotificationToBarid", PublicMethods.get_exception(ex), ModuleIdentifier.Jobs); } } return(failed); }
private static void update_users(Guid applicationId) { string nodeTypeAdditionalId = "2246"; //کد کلاس مناطق Guid? nodeTypeId = CNController.get_node_type_id(applicationId, nodeTypeAdditionalId); if (!nodeTypeId.HasValue) { return; } Dictionary <string, string> codes = new Dictionary <string, string>(); //Key: HRIS Code, Value: RaaiVan AdditionalID codes["83"] = "10028"; //منطقه کرمانشاه codes["76"] = "10035"; //منطقه هرمزگان codes["17"] = "10030"; //منطقه گلستان codes["44"] = "10012"; //منطقه آذربایجان غربی codes["63"] = "10019"; //منطقه خوزستان codes["35"] = "10037"; //منطقه یزد codes["86"] = "10034"; //منطقه مرکزی codes["34"] = "10027"; //منطقه کرمان codes["45"] = "10006"; //منطقه اردبیل codes["77"] = "10013"; //منطقه بوشهر codes["25"] = "10025"; //منطقه قم codes["24"] = "10020"; //منطقه زنجان codes["13"] = "10031"; //منطقه گیلان codes["38"] = "10015"; //منطقه چهار محال و بختیاری codes["15"] = "10033"; //منطقه مازندران codes["41"] = "10010"; //منطقه آذربایجان شرقی codes["56"] = "10016"; //منطقه خراسان جنوبی codes["23"] = "10021"; //منطقه سمنان codes["31"] = "10007"; //منطقه اصفهان codes["54"] = "10022"; //منطقه سیستان و بلوچستان codes["10"] = "10003"; //شرکت مخابرات ایران codes["58"] = "10018"; //منطقه خراسان شمالی codes["87"] = "10026"; //منطقه کردستان codes["28"] = "10024"; //منطقه قزوین codes["66"] = "10032"; //منطقه لرستان codes["81"] = "10036"; //منطقه همدان codes["84"] = "10009"; //منطقه ایلام codes["74"] = "10029"; //منطقه کهگیلویه و بویراحمد codes["51"] = "10017"; //منطقه خراسان رضوی codes["71"] = "10023"; //منطقه فارس codes["92"] = "10005"; //شرکت مدیریت املاک( سامان سازه غدیر) codes["21"] = "10014"; //منطقه تهران /* * codes[""] = "10008"; //منطقه البرز * codes[""] = "10001"; //شرکت گسترش خدمات ارتباطات کاراشاب */ codes.Keys.ToList().ForEach(key => { List <ExchangeUser> users = get_useres(applicationId, key); if (users.Count == 0) { return; } Guid nodeId = CNController.get_node_id(applicationId, codes[key], nodeTypeId.Value); if (nodeId == Guid.Empty) { return; } List <NodeMember> admins = CNController.get_members(applicationId, nodeId, null, true); List <ExchangeMember> members = new List <ExchangeMember>(); users.ForEach(u => members.Add(new ExchangeMember() { NodeTypeAdditionalID = nodeTypeAdditionalId, NodeAdditionalID = codes[key], UserName = u.UserName, IsAdmin = admins.Any(m => m.Member.UserName.ToLower() == u.UserName.ToLower()) })); PublicMethods.split_list <ExchangeUser>(users, 200, items => { DEController.update_users(applicationId, items); }, 2000); PublicMethods.split_list <ExchangeMember>(members, 200, items => { DEController.update_members(applicationId, items); }, 2000); //Save Log LogController.save_error_log(applicationId, null, "update_users_with_hris", "Code: " + key + ", Count: " + members.Count.ToString(), ModuleIdentifier.Jobs, LogLevel.Trace); //end of Save Log }); }
private void PackingTest_FormClosing(object sender, FormClosingEventArgs e) { _cncConnector.Disconnect(); CNController.CNC_Exit(); }
private static void _send_notification(Guid applicationId, Notification info) { if (!RaaiVanConfig.Modules.Notifications(applicationId)) { return; } if (!info.Action.HasValue || info.Action.Value == ActionType.None || !info.SubjectType.HasValue || info.SubjectType.Value == SubjectType.None) { return; } List <Pair> users = new List <Pair>(); if (info.UserID.HasValue && info.UserID != info.Sender.UserID) { users.Add(new Pair(info.UserID.Value, UserStatus.Owner)); } List <Guid> userIds = new List <Guid>(); List <Guid> mentionedUserIds = info.Action == ActionType.Post || info.Action == ActionType.Share || info.Action == ActionType.Comment ? Expressions.get_tagged_items(info.Description, "User").Where(u => u.ID.HasValue && u.ID != info.UserID) .Select(u => u.ID.Value).ToList() : new List <Guid>(); info.Description = PublicMethods.markup2plaintext(applicationId, Expressions.replace(info.Description, Expressions.Patterns.HTMLTag, " ")); switch (info.Action.Value) { case ActionType.Like: switch (info.SubjectType.Value) { case SubjectType.Node: if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = CNController.get_node_creators(applicationId, info.RefItemID.Value).Select( u => u.User.UserID.Value).ToList(); } foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Owner)); } if ((userIds = __get_audience_user_ids(ref info, UserStatus.Member)) == null) { userIds = CNController.get_member_user_ids(applicationId, info.RefItemID.Value, NodeMemberStatuses.Accepted); } foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Member)); } if ((userIds = __get_audience_user_ids(ref info, UserStatus.Expert)) == null) { userIds = CNController.get_experts(applicationId, info.RefItemID.Value).Select( u => u.User.UserID.Value).ToList(); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Expert)); } Node node = CNController.get_node(applicationId, info.RefItemID.Value, true); if (node != null) { info.SubjectName = node.Name; info.Description = node.Description; info.Info = "{\"NodeType\":\"" + Base64.encode(node.NodeType) + "\"}"; } break; case SubjectType.Question: if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = new List <Guid>() { }; Guid?id = QAController.get_question_asker_id(applicationId, info.RefItemID.Value); if (id.HasValue) { userIds.Add(id.Value); } } foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Owner)); } Question question = QAController.get_question(applicationId, info.RefItemID.Value, null); if (question != null) { info.SubjectName = question.Title; info.Description = question.Description; } break; case SubjectType.Post: if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = new List <Guid>(); Guid?id = SharingController.get_post_sender_id(applicationId, info.RefItemID.Value); if (id.HasValue) { userIds.Add(id.Value); } } foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Owner)); } Post post = SharingController.get_post(applicationId, info.RefItemID.Value, null); info.Description = string.IsNullOrEmpty(post.Description) ? post.OriginalDescription : post.Description; break; case SubjectType.Comment: if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = new List <Guid>(); Guid?id = SharingController.get_comment_sender_id(applicationId, info.SubjectID.Value); if (id.HasValue) { userIds.Add(id.Value); } } foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Owner)); } Sharing.Comment comment = SharingController.get_comment(applicationId, info.SubjectID.Value, null); info.RefItemID = comment.PostID; info.Description = comment.Description; break; } break; case ActionType.Dislike: switch (info.SubjectType.Value) { case SubjectType.Post: if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = new List <Guid>(); Guid?id = SharingController.get_post_sender_id(applicationId, info.RefItemID.Value); if (id.HasValue) { userIds.Add(id.Value); } } foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Owner)); } Post post = SharingController.get_post(applicationId, info.RefItemID.Value, null); info.Description = string.IsNullOrEmpty(post.Description) ? post.OriginalDescription : post.Description; break; case SubjectType.Comment: if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = new List <Guid>(); Guid?id = SharingController.get_comment_sender_id(applicationId, info.SubjectID.Value); if (id.HasValue) { userIds.Add(id.Value); } } foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Owner)); } Sharing.Comment comment = SharingController.get_comment(applicationId, info.SubjectID.Value, null); info.RefItemID = comment.PostID; info.Description = comment.Description; break; } break; case ActionType.Question: switch (info.SubjectType.Value) { case SubjectType.Question: if (info.ReceiverUserIDs != null && info.ReceiverUserIDs.Count > 0) { userIds = info.ReceiverUserIDs; foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Contributor)); } } break; } break; case ActionType.Answer: switch (info.SubjectType.Value) { case SubjectType.Answer: if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = new List <Guid>(); Guid?id = QAController.get_question_asker_id(applicationId, info.RefItemID.Value); if (id.HasValue) { userIds.Add(id.Value); } } foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Owner)); } if ((userIds = __get_audience_user_ids(ref info, UserStatus.Fan)) == null) { userIds = GlobalController.get_fan_ids(applicationId, info.RefItemID.Value).ToList(); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Fan)); } if ((userIds = __get_audience_user_ids(ref info, UserStatus.Contributor)) == null) { userIds = QAController.get_answer_sender_ids(applicationId, info.RefItemID.Value).ToList(); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Contributor)); } info.SubjectName = QAController.get_question(applicationId, info.RefItemID.Value, null).Title; break; } break; case ActionType.Post: case ActionType.Share: switch (info.SubjectType.Value) { case SubjectType.Post: foreach (Guid _usr in mentionedUserIds) { users.Add(new Pair(_usr, UserStatus.Mentioned)); } Node node = null; bool isNode = info.RefItemID.HasValue && CNController.is_node(applicationId, info.RefItemID.Value); if ((userIds = __get_audience_user_ids(ref info, UserStatus.Director)) != null) { foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Owner)); } } if (isNode) { if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = CNController.get_node_creators(applicationId, info.RefItemID.Value).Select( u => u.User.UserID.Value).ToList(); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Owner)); } if ((userIds = __get_audience_user_ids(ref info, UserStatus.Member)) == null) { userIds = CNController.get_members(applicationId, info.RefItemID.Value, pending: false, admin: null).Select(u => u.Member.UserID.Value).ToList(); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Member)); } if ((userIds = __get_audience_user_ids(ref info, UserStatus.Fan)) == null) { userIds = CNController.get_node_fans_user_ids(applicationId, info.RefItemID.Value).ToList(); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Fan)); } node = CNController.get_node(applicationId, info.RefItemID.Value); if (node != null) { info.SubjectName = node.Name; } } if (RaaiVanConfig.Modules.SMSEMailNotifier(applicationId)) { User user = UsersController.get_user(applicationId, info.Sender.UserID.Value); info.ReplacementDic["SenderProfileImageURL"] = DocumentUtilities.get_personal_image_address(applicationId, user.UserID.Value, true); info.ReplacementDic["SenderFullName"] = user.FirstName + " " + user.LastName; info.ReplacementDic["SenderPageURL"] = PublicConsts.get_complete_url(applicationId, PublicConsts.HomePage) + "/" + user.UserID.Value.ToString(); info.ReplacementDic["PostURL"] = PublicConsts.get_complete_url(applicationId, PublicConsts.PostPage) + "/" + info.SubjectID.Value.ToString(); info.ReplacementDic["Description"] = info.Description; if (isNode) { info.ReplacementDic["NodePageURL"] = PublicConsts.get_complete_url(applicationId, PublicConsts.NodePage) + "/" + info.RefItemID.Value.ToString(); if (node != null) { info.ReplacementDic["NodeName"] = node.Name; } } } break; } break; case ActionType.Comment: switch (info.SubjectType.Value) { case SubjectType.Comment: foreach (Guid _usr in mentionedUserIds) { users.Add(new Pair(_usr, UserStatus.Mentioned)); } if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = new List <Guid>(); Guid?id = SharingController.get_post_sender_id(applicationId, info.RefItemID.Value); if (id.HasValue) { userIds.Add(id.Value); } } foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Owner)); } if ((userIds = __get_audience_user_ids(ref info, UserStatus.Fan)) == null) { userIds = SharingController.get_post_fan_ids(applicationId, info.RefItemID.Value).ToList(); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Fan)); } if ((userIds = __get_audience_user_ids(ref info, UserStatus.Contributor)) == null) { userIds = SharingController.get_comment_sender_ids(applicationId, info.RefItemID.Value).ToList(); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Contributor)); } if (RaaiVanConfig.Modules.SMSEMailNotifier(applicationId)) { User user = UsersController.get_user(applicationId, info.Sender.UserID.Value); info.ReplacementDic["SenderProfileImageURL"] = DocumentUtilities.get_personal_image_address(applicationId, user.UserID.Value, true); info.ReplacementDic["SenderFullName"] = user.FirstName + " " + user.LastName; info.ReplacementDic["SenderPageURL"] = PublicConsts.get_complete_url(applicationId, PublicConsts.ProfilePage) + "/" + user.UserID.Value.ToString(); info.ReplacementDic["PostURL"] = PublicConsts.get_complete_url(applicationId, PublicConsts.PostPage) + "/" + info.RefItemID.Value.ToString(); info.ReplacementDic["Description"] = info.Description; } break; case SubjectType.Question: if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = new List <Guid>(); Guid?id = QAController.get_question_asker_id(applicationId, info.RefItemID.Value); if (id.HasValue) { userIds.Add(id.Value); } } foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Owner)); } break; case SubjectType.Answer: if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = new List <Guid>(); Guid?commentId = QAController.get_comment_owner_id(applicationId, info.SubjectID.Value); if (commentId.HasValue) { userIds.Add(commentId.Value); } } foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Owner)); } break; } break; case ActionType.Modify: switch (info.SubjectType.Value) { case SubjectType.Wiki: Node node = CNController.get_node(applicationId, info.RefItemID.Value, false); if (node != null && node.NodeID.HasValue) { if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = CNController.get_node_creators(applicationId, info.RefItemID.Value).Select( u => u.User.UserID.Value).ToList(); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Owner)); } if ((userIds = __get_audience_user_ids(ref info, UserStatus.Fan)) == null) { userIds = CNController.get_node_fans_user_ids(applicationId, info.RefItemID.Value).ToList(); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Fan)); } if ((userIds = __get_audience_user_ids(ref info, UserStatus.Expert)) == null) { userIds = CNController.get_experts(applicationId, info.RefItemID.Value).Select( u => u.User.UserID.Value).ToList(); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Expert)); } if ((userIds = __get_audience_user_ids(ref info, UserStatus.Member)) == null) { userIds = CNController.get_member_user_ids(applicationId, info.RefItemID.Value); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Member)); } if (!users.Exists(u => (UserStatus)u.Second == UserStatus.Owner)) { users.Add(new Pair(node.Creator.UserID.Value, UserStatus.Owner)); } info.SubjectName = node.Name; info.Info = "{\"NodeType\":\"" + Base64.encode(node.NodeType) + "\"}"; if (RaaiVanConfig.Modules.SMSEMailNotifier(applicationId)) { User user = UsersController.get_user(applicationId, info.Sender.UserID.Value); info.ReplacementDic["SenderProfileImageURL"] = DocumentUtilities.get_personal_image_address(applicationId, user.UserID.Value, true); info.ReplacementDic["SenderFullName"] = user.FirstName + " " + user.LastName; info.ReplacementDic["SenderPageURL"] = PublicConsts.get_complete_url(applicationId, PublicConsts.ProfilePage) + "/" + user.UserID.Value.ToString(); info.ReplacementDic["NodeName"] = node.Name; info.ReplacementDic["NodeType"] = node.NodeType; info.ReplacementDic["NodePageURL"] = PublicConsts.get_complete_url(applicationId, PublicConsts.NodePage) + "/" + info.RefItemID.Value.ToString(); info.ReplacementDic["Description"] = info.Description; } } break; } break; case ActionType.FriendRequest: switch (info.SubjectType.Value) { case SubjectType.User: users.Clear(); users.Add(new Pair(info.UserID, UserStatus.Mentioned)); info.UserStatus = UserStatus.Mentioned; if (RaaiVanConfig.Modules.SMSEMailNotifier(applicationId)) { User user = UsersController.get_user(applicationId, info.RefItemID.Value); info.ReplacementDic["SenderProfileImageURL"] = DocumentUtilities.get_personal_image_address(applicationId, user.UserID.Value, true); info.ReplacementDic["SenderFullName"] = user.FirstName + " " + user.LastName; info.ReplacementDic["SenderPageURL"] = PublicConsts.get_complete_url(applicationId, PublicConsts.ProfilePage) + "/" + user.UserID.Value.ToString(); } break; } break; case ActionType.AcceptFriendRequest: switch (info.SubjectType.Value) { case SubjectType.User: users.Clear(); users.Add(new Pair(info.UserID, UserStatus.Mentioned)); info.UserStatus = UserStatus.Mentioned; if (RaaiVanConfig.Modules.SMSEMailNotifier(applicationId)) { User user = UsersController.get_user(applicationId, info.RefItemID.Value); info.ReplacementDic["SenderProfileImageURL"] = DocumentUtilities.get_personal_image_address(applicationId, user.UserID.Value, true); info.ReplacementDic["SenderFullName"] = user.FirstName + " " + user.LastName; info.ReplacementDic["SenderPageURL"] = PublicConsts.get_complete_url(applicationId, PublicConsts.ProfilePage) + "/" + user.UserID.Value.ToString(); } break; } break; case ActionType.Accept: switch (info.SubjectType) { case SubjectType.Node: { if ((userIds = __get_audience_user_ids(ref info, UserStatus.Member)) == null && info.RefItemID.HasValue) { List <Guid> nIds = CNController.get_related_node_ids(applicationId, info.RefItemID.Value, null, null, false, true); List <Guid> creatorIds = CNController.get_node_creators(applicationId, info.RefItemID.Value) .Select(u => u.User.UserID.Value).ToList(); userIds = CNController.get_members(applicationId, nIds, pending: false, admin: null).Select(u => u.Member.UserID.Value) .Distinct().Where(x => !creatorIds.Any(a => a == x)).ToList(); } foreach (Guid _usr in userIds) { users.Add(new Pair(_usr, UserStatus.Member)); } } break; } break; case ActionType.Publish: switch (info.SubjectType) { case SubjectType.Question: if ((userIds = __get_audience_user_ids(ref info, UserStatus.Owner)) == null) { userIds = new List <Guid>(); Guid?id = QAController.get_question_asker_id(applicationId, info.RefItemID.Value); if (id.HasValue) { userIds.Add(id.Value); } } foreach (Guid _uid in userIds) { users.Add(new Pair(_uid, UserStatus.Owner)); } break; } break; } users = users.Except(users.Where(u => info.Sender.UserID.HasValue && (Guid)u.First == info.Sender.UserID)).ToList(); DataProvider.SendNotification(applicationId, ref users, info); if (RaaiVanConfig.Modules.SMSEMailNotifier(applicationId)) { NotificationController._send_notification_message(applicationId, users, info); } }
public void ProcessRequest(HttpContext context) { //Privacy Check: OK paramsContainer = new ParamsContainer(context, nullTenantResponse: true); if (!paramsContainer.ApplicationID.HasValue) { return; } string responseText = string.Empty; string command = PublicMethods.parse_string(context.Request.Params["Command"], false); if (string.IsNullOrEmpty(command)) { return; } Guid currentUserId = paramsContainer.CurrentUserID.HasValue ? paramsContainer.CurrentUserID.Value : Guid.Empty; Guid fileId = string.IsNullOrEmpty(context.Request.Params["FileID"]) ? Guid.Empty : Guid.Parse(context.Request.Params["FileID"]); DocFileInfo file = DocumentsController.get_file(paramsContainer.Tenant.Id, fileId); if (file == null) { paramsContainer.return_response(PublicConsts.BadRequestResponse); return; } bool isTemporary = PublicMethods.parse_string(HttpContext.Current.Request.Params["Category"], false).ToLower() == "temporary"; bool hasAccess = isTemporary || PublicMethods.is_system_admin(paramsContainer.Tenant.Id, currentUserId); PrivacyObjectType pot = file.OwnerType == FileOwnerTypes.Node ? PrivacyObjectType.Node : PrivacyObjectType.None; hasAccess = hasAccess || PrivacyController.check_access(paramsContainer.Tenant.Id, paramsContainer.CurrentUserID, file.OwnerID.Value, pot, PermissionType.View); if (!hasAccess && currentUserId != Guid.Empty && CNController.is_node(paramsContainer.Tenant.Id, file.OwnerID.Value)) { bool isCreator = false, isContributor = false, isExpert = false, isMember = false, isAdminMember = false, isServiceAdmin = false, isAreaAdmin = false, perCreatorLevel = false; CNController.get_user2node_status(paramsContainer.Tenant.Id, paramsContainer.CurrentUserID.Value, file.OwnerID.Value, ref isCreator, ref isContributor, ref isExpert, ref isMember, ref isAdminMember, ref isServiceAdmin, ref isAreaAdmin, ref perCreatorLevel); hasAccess = isServiceAdmin || isAreaAdmin || isCreator || isContributor || isExpert || isMember; } if (!hasAccess) { paramsContainer.return_response("{\"ErrorText\":\"" + Messages.AccessDenied.ToString() + "\"}"); } if (isTemporary) { file.FolderName = FolderNames.TemporaryFiles; } else { file.refresh_folder_name(); } if (!file.exists(paramsContainer.Tenant.Id)) { _return_response(ref responseText); } DocFileInfo destFile = new DocFileInfo() { FileID = file.FileID, FolderName = FolderNames.PDFImages }; switch (command) { case "Convert2Image": convert2image(file, PublicMethods.parse_string(context.Request.Params["PS"]), destFile, PublicMethods.parse_bool(context.Request.Params["Repair"]), ref responseText); _return_response(ref responseText); return; case "GetPagesCount": get_pages_count(file, PublicMethods.parse_string(context.Request.Params["PS"]), destFile, ref responseText); _return_response(ref responseText); return; case "GetPage": get_page(PublicMethods.parse_int(context.Request.Params["Page"], 1), destFile); return; } paramsContainer.return_response(PublicConsts.BadRequestResponse); }
protected bool check_object_type(List <Guid> objectIds, PrivacyObjectType objectType) { switch (objectType) { case PrivacyObjectType.None: case PrivacyObjectType.Node: case PrivacyObjectType.NodeType: { if (objectIds.Count != 1) { return(false); } bool isNodeType = objectType != PrivacyObjectType.Node && CNController.is_node_type(paramsContainer.Tenant.Id, objectIds).Count == objectIds.Count; bool isNode = !isNodeType && objectType != PrivacyObjectType.NodeType && CNController.is_node(paramsContainer.Tenant.Id, objectIds).Count == objectIds.Count; if (!isNodeType && !isNode) { return(false); } bool accessPermission = AuthorizationManager.has_right(AccessRoleName.ManageOntology, paramsContainer.CurrentUserID); if (!accessPermission) { accessPermission = CNController.is_service_admin(paramsContainer.Tenant.Id, objectIds[0], paramsContainer.CurrentUserID.Value); } if (!accessPermission && isNode) { accessPermission = CNController.is_node_admin(paramsContainer.Tenant.Id, paramsContainer.CurrentUserID.Value, objectIds[0], null, null, null) || PrivacyController.check_access(paramsContainer.Tenant.Id, paramsContainer.CurrentUserID, objectIds[0], PrivacyObjectType.Node, PermissionType.Modify); } return(accessPermission); } case PrivacyObjectType.FAQCategory: return(QAController.is_faq_category(paramsContainer.Tenant.Id, objectIds).Count == objectIds.Count && (AuthorizationManager.has_right(AccessRoleName.ManageQA, paramsContainer.CurrentUserID) || QAController.is_workflow_admin(paramsContainer.Tenant.Id, paramsContainer.CurrentUserID.Value, null))); case PrivacyObjectType.QAWorkFlow: return(QAController.is_workflow(paramsContainer.Tenant.Id, objectIds).Count == objectIds.Count && AuthorizationManager.has_right(AccessRoleName.ManageQA, paramsContainer.CurrentUserID)); case PrivacyObjectType.Poll: return(FGController.is_poll(paramsContainer.Tenant.Id, objectIds).Count == objectIds.Count && AuthorizationManager.has_right(AccessRoleName.ManagePolls, paramsContainer.CurrentUserID)); case PrivacyObjectType.Report: return(!objectIds.Any(u => !ReportUtilities.ReportIDs.Any(x => x.Value == u)) && PublicMethods.is_system_admin(paramsContainer.Tenant.Id, paramsContainer.CurrentUserID.Value)); case PrivacyObjectType.FormElement: return(FGController.is_form_element(paramsContainer.Tenant.Id, objectIds).Count == objectIds.Count && AuthorizationManager.has_right(AccessRoleName.ManageForms, paramsContainer.CurrentUserID)); } return(false); }