Exemplo n.º 1
0
        public static guidanceItem transform_into_guidanceItem(this TeamMentor_Article article)
        {
            if (article.isNull())
            {
                return(null);
            }
            return(new guidanceItem()
            {
                id = article.Metadata.Id.str(),
                id_original = article.Metadata.Id_History,
                title = article.Metadata.Title,

                Technology = article.Metadata.Technology,
                phase = article.Metadata.Phase,
                Category = article.Metadata.Category,
                Rule_Type = article.Metadata.Type,

                content = article.Content.Data.Value
            });
        }
Exemplo n.º 2
0
        public TeamMentor_Article transform()
        {
            // fix the issue with older SI Library Articles
            if (this.phase == null)
            {
                this.phase     = this.Rule_Type;
                this.Rule_Type = this.Type;
            }
            var teamMentor_Article = new TeamMentor_Article();

            teamMentor_Article.Metadata = new TeamMentor_Article_Metadata()
            {
                Id         = this.id.guid(),
                Id_History = this.id_Original,
                Library_Id = this.libraryId.guid(),
                Title      = this.title,
                Category   = this.Category,
                Phase      = this.phase,
                Technology = this.Technology,
                Type       = this.Rule_Type,
                Author     = this.Author,
                Priority   = this.Priority,
                Status     = this.Status,
                Source     = this.Source,

                DirectLink      = "",
                Tag             = "",
                Security_Demand = "",
            };

            teamMentor_Article.Content = new TeamMentor_Article_Content()
            {
                Sanitized = true,
                DataType  = "Html"
            };
            teamMentor_Article.Content.Data.Value = this.content;
            teamMentor_Article.setHashes();
            teamMentor_Article.htmlEncode();            //encode contents
            return(teamMentor_Article);
        }
Exemplo n.º 3
0
        //this causes  double encoding problems with some properties (like the Title on Html Editor) , but removing it opens up more XSS on other viewers (like the Table)
        public static TeamMentor_Article htmlEncode(this TeamMentor_Article article)
        {
            if (article.isNull())
            {
                return(null);
            }
            var metaData = article.Metadata;

            foreach (var prop in metaData.type().properties())
            {
                if (prop.PropertyType == typeof(string))
                {
                    var value = (string)metaData.prop(prop.Name);
                    metaData.prop(prop.Name, Encoder.HtmlEncode(value));
                }
            }
            if (TMConfig.Current.SanitizeHtmlContent)
            {
                article.Content.Data.Value = Sanitizer.GetSafeHtmlFragment(article.Content.Data.Value);
                article.Content.Sanitized  = true;
            }

            return(article);
        }
 public Guid CreateArticle_Simple(Guid libraryId, string title, string dataType, string htmlCode)
 {
     this.resetCache();
                                                                                     var article = new TeamMentor_Article();
                                                                                     article.Metadata.Library_Id = libraryId;
                                                                                     article.Metadata.Title = title;
                                                                                     article.Content.DataType = dataType;
                                                                                     article.Content.Data.Value = htmlCode;
                                                                                     return javascriptProxy.CreateArticle(article);
 }
 public Guid CreateArticle(TeamMentor_Article article)
 {
     this.resetCache(); return javascriptProxy.CreateArticle(article);
 }
 public bool UpdateGuidanceItem(TeamMentor_Article guidanceItem)
 {
     this.resetCache();
                                                                                     var result = javascriptProxy.UpdateGuidanceItem(guidanceItem);
                                                                                     return result;
 }
		[WebMethod(EnableSession = true)]	[EditArticles(SecurityAction.Demand)]	public bool UpdateGuidanceItem(TeamMentor_Article guidanceItem)						
																						{ 
																							this.resetCache();
																							var result = javascriptProxy.UpdateGuidanceItem(guidanceItem); 	
																							return result;
																						}	
 [WebMethod(EnableSession = true)]	[EditArticles(SecurityAction.Demand)]	public Guid CreateArticle_Simple(Guid libraryId, string title, string dataType, string htmlCode)					       
                                                                                 { 
                                                                                     this.resetCache(); 
                                                                                     var article = new TeamMentor_Article();
                                                                                     article.Metadata.Library_Id = libraryId;
                                                                                     article.Metadata.Title = title;
                                                                                     article.Content.DataType = dataType;
                                                                                     article.Content.Data.Value = htmlCode;
                                                                                     return javascriptProxy.CreateArticle(article); 
                                                                                 }
 [WebMethod(EnableSession = true)]	[EditArticles(SecurityAction.Demand)]	public Guid CreateArticle(TeamMentor_Article article)					            { this.resetCache(); return javascriptProxy.CreateArticle(article); 	}
Exemplo n.º 10
0
 public static TeamMentor_Article setHashes(this TeamMentor_Article article)
 {
     article.Metadata_Hash = article.Metadata.serialize(false).hash();
     article.Content_Hash  = article.Content.serialize(false).hash();
     return(article);
 }
        public TeamMentor_Article transform()
        {
            // fix the issue with older SI Library Articles
            if (this.phase == null)
            {
                this.phase		= this.Rule_Type;
                this.Rule_Type  = this.Type;
            }
            var teamMentor_Article = new TeamMentor_Article();
            teamMentor_Article.Metadata = new TeamMentor_Article_Metadata()
                                                {
                                                    Id			 = this.id.guid(),
                                                    Id_History   = this.id_Original,
                                                    Library_Id   = this.libraryId.guid(),
                                                    Title		 = this.title,
                                                    Category	 = this.Category,
                                                    Phase		 = this.phase,
                                                    Technology   = this.Technology,
                                                    Type		 = this.Rule_Type,
                                                    Author		 = this.Author,
                                                    Priority	 = this.Priority,
                                                    Status		 = this.Status,
                                                    Source		 = this.Source,

                                                    DirectLink      = "",
                                                    Tag             = "",
                                                    Security_Demand = "",
                                                };

            teamMentor_Article.Content = new TeamMentor_Article_Content()
                                                {
                                                    Sanitized    = true,
                                                    DataType     = "Html"
                                                };
            teamMentor_Article.Content.Data.Value = this.content;
            teamMentor_Article.setHashes();
            return teamMentor_Article;
        }