Skip to content

Commit 91d5427

Browse files
committed
Made Topic ACL enabled
1 parent 996f1be commit 91d5427

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+660
-351
lines changed

changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# Release Notes
1+
# Release Notes
22

33
## SmartStore.NET 3.2
44

55
### New Features
66
* #1144 Enable multi server search index
7+
* Made Topic ACL enabled
78
* Implemented paging & filtering for Topic grid
89
* **BeezUp**:
910
* #1459 Add option to only submit one category name per product

src/Libraries/SmartStore.Core/Domain/Topics/Topic.cs

Lines changed: 136 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,162 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Runtime.Serialization;
45
using SmartStore.Core.Domain.Localization;
6+
using SmartStore.Core.Domain.Security;
57
using SmartStore.Core.Domain.Seo;
68
using SmartStore.Core.Domain.Stores;
79

810
namespace SmartStore.Core.Domain.Topics
911
{
10-
/// <summary>
11-
/// Represents a topic
12-
/// </summary>
13-
public partial class Topic : BaseEntity, ILocalizedEntity, ISlugSupported, IStoreMappingSupported
12+
/// <summary>
13+
/// Represents a topic
14+
/// </summary>
15+
[DataContract]
16+
public partial class Topic : BaseEntity, ILocalizedEntity, ISlugSupported, IStoreMappingSupported, IAclSupported
1417
{
15-
/// <summary>
16-
/// Gets or sets the name
17-
/// </summary>
18-
public string SystemName { get; set; }
19-
20-
/// <summary>
21-
/// Gets or sets the value indicating whether this topic is deleteable by a user
22-
/// </summary>
23-
public bool IsSystemTopic { get; set; }
24-
25-
/// <summary>
26-
/// Gets or sets the value indicating whether this topic should be included in sitemap
27-
/// </summary>
28-
public bool IncludeInSitemap { get; set; }
29-
30-
/// <summary>
31-
/// Gets or sets the value indicating whether this topic is password protected
32-
/// </summary>
33-
public bool IsPasswordProtected { get; set; }
34-
35-
/// <summary>
36-
/// Gets or sets the password
37-
/// </summary>
38-
public string Password { get; set; }
39-
40-
/// <summary>
41-
/// Gets or sets the title
42-
/// </summary>
43-
public string Title { get; set; }
44-
45-
/// <summary>
46-
/// Gets or sets the body
47-
/// </summary>
48-
public string Body { get; set; }
49-
50-
/// <summary>
51-
/// Gets or sets the meta keywords
52-
/// </summary>
53-
public string MetaKeywords { get; set; }
54-
55-
/// <summary>
56-
/// Gets or sets the meta description
57-
/// </summary>
58-
public string MetaDescription { get; set; }
59-
60-
/// <summary>
61-
/// Gets or sets the meta title
62-
/// </summary>
63-
public string MetaTitle { get; set; }
18+
public Topic()
19+
{
20+
IsPublished = true;
21+
}
22+
23+
/// <summary>
24+
/// Gets or sets the name
25+
/// </summary>
26+
[DataMember]
27+
public string SystemName { get; set; }
28+
29+
/// <summary>
30+
/// Gets or sets the value indicating whether this topic is deleteable by a user
31+
/// </summary>
32+
[DataMember]
33+
public bool IsSystemTopic { get; set; }
34+
35+
/// <summary>
36+
/// Gets or sets the value indicating whether this topic should be included in sitemap
37+
/// </summary>
38+
[DataMember]
39+
public bool IncludeInSitemap { get; set; }
40+
41+
/// <summary>
42+
/// Gets or sets the value indicating whether this topic is password protected
43+
/// </summary>
44+
[DataMember]
45+
public bool IsPasswordProtected { get; set; }
46+
47+
/// <summary>
48+
/// Gets or sets the password
49+
/// </summary>
50+
[DataMember]
51+
public string Password { get; set; }
52+
53+
/// <summary>
54+
/// Gets or sets the title
55+
/// </summary>
56+
[DataMember]
57+
public string Title { get; set; }
58+
59+
/// <summary>
60+
/// Gets or sets the short title (for links)
61+
/// </summary>
62+
[DataMember]
63+
public string ShortTitle { get; set; }
64+
65+
/// <summary>
66+
/// Gets or sets the intro
67+
/// </summary>
68+
[DataMember]
69+
public string Intro { get; set; }
70+
71+
/// <summary>
72+
/// Gets or sets the body
73+
/// </summary>
74+
[DataMember]
75+
public string Body { get; set; }
76+
77+
/// <summary>
78+
/// Gets or sets the meta keywords
79+
/// </summary>
80+
[DataMember]
81+
public string MetaKeywords { get; set; }
82+
83+
/// <summary>
84+
/// Gets or sets the meta description
85+
/// </summary>
86+
[DataMember]
87+
public string MetaDescription { get; set; }
88+
89+
/// <summary>
90+
/// Gets or sets the meta title
91+
/// </summary>
92+
[DataMember]
93+
public string MetaTitle { get; set; }
6494

6595
/// <summary>
6696
/// Gets or sets a value indicating whether the entity is limited/restricted to certain stores
6797
/// </summary>
98+
[DataMember]
6899
public bool LimitedToStores { get; set; }
69100

70-
/// <summary>
71-
/// Gets or sets a value indicating whether the topic should also be rendered as a generic html widget
72-
/// </summary>
73-
public bool RenderAsWidget { get; set; }
101+
/// <summary>
102+
/// Gets or sets a value indicating whether the topic should also be rendered as a generic html widget
103+
/// </summary>
104+
[DataMember]
105+
public bool RenderAsWidget { get; set; }
74106

75-
/// <summary>
76-
/// Gets or sets the widget zone name
77-
/// </summary>
78-
public string WidgetZone { get; set; }
107+
/// <summary>
108+
/// Gets or sets the widget zone name
109+
/// </summary>
110+
[DataMember]
111+
public string WidgetZone { get; set; }
79112

80113
/// <summary>
81114
/// Gets or sets a value indicating whether the content should be surrounded by a topic block wrapper
82115
/// </summary>
116+
[DataMember]
83117
public bool? WidgetWrapContent { get; set; }
84118

85-
/// <summary>
86-
/// Gets or sets a value indicating whether the title should be displayed in the widget block
87-
/// </summary>
88-
public bool WidgetShowTitle { get; set; }
89-
90-
/// <summary>
91-
/// Gets or sets a value indicating whether the widget block should have borders
92-
/// </summary>
93-
public bool WidgetBordered { get; set; }
94-
95-
/// <summary>
96-
/// Gets or sets the sort order (relevant for widgets)
97-
/// </summary>
98-
public int Priority { get; set; }
99-
100-
/// <summary>
101-
/// Gets or sets the title tag
102-
/// </summary>
103-
public string TitleTag { get; set; }
104-
105-
/// <summary>
106-
/// Helper function which gets the comma-separated <c>WidgetZone</c> property as list of strings
107-
/// </summary>
108-
/// <returns></returns>
109-
public IEnumerable<string> GetWidgetZones()
119+
/// <summary>
120+
/// Gets or sets a value indicating whether the title should be displayed in the widget block
121+
/// </summary>
122+
[DataMember]
123+
public bool WidgetShowTitle { get; set; }
124+
125+
/// <summary>
126+
/// Gets or sets a value indicating whether the widget block should have borders
127+
/// </summary>
128+
[DataMember]
129+
public bool WidgetBordered { get; set; }
130+
131+
/// <summary>
132+
/// Gets or sets the sort order (relevant for widgets)
133+
/// </summary>
134+
[DataMember]
135+
public int Priority { get; set; }
136+
137+
/// <summary>
138+
/// Gets or sets the title tag
139+
/// </summary>
140+
[DataMember]
141+
public string TitleTag { get; set; }
142+
143+
/// <summary>
144+
/// Gets or sets a value indicating whether the entity is subject to ACL
145+
/// </summary>
146+
[DataMember]
147+
public bool SubjectToAcl { get; set; }
148+
149+
/// <summary>
150+
/// Gets or sets a value indicating whether the topic page is published
151+
/// </summary>
152+
[DataMember]
153+
public bool IsPublished { get; set; }
154+
155+
/// <summary>
156+
/// Helper function which gets the comma-separated <c>WidgetZone</c> property as list of strings
157+
/// </summary>
158+
/// <returns></returns>
159+
public IEnumerable<string> GetWidgetZones()
110160
{
111161
if (this.WidgetZone.IsEmpty())
112162
{

src/Libraries/SmartStore.Data/Mapping/Topics/TopicMap.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ public TopicMap()
99
{
1010
this.ToTable("Topic");
1111
this.HasKey(t => t.Id);
12+
this.Property(t => t.ShortTitle).HasMaxLength(50);
13+
this.Property(t => t.Intro).HasMaxLength(255);
1214
this.Property(t => t.Body).IsMaxLength();
13-
}
15+
//this.Property(t => t.IsPublished).HasColumnAnnotation("defaultValue", true);
16+
}
1417
}
1518
}

src/Libraries/SmartStore.Data/Migrations/201807122120062_TopicAcl.Designer.cs

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
namespace SmartStore.Data.Migrations
2+
{
3+
using System;
4+
using System.Data.Entity.Migrations;
5+
6+
public partial class TopicAcl : DbMigration
7+
{
8+
public override void Up()
9+
{
10+
DropIndex("dbo.Customer", "IX_Customer_CustomerNumber");
11+
AddColumn("dbo.Topic", "ShortTitle", c => c.String(maxLength: 50));
12+
AddColumn("dbo.Topic", "Intro", c => c.String(maxLength: 255));
13+
AddColumn("dbo.Topic", "SubjectToAcl", c => c.Boolean(nullable: false));
14+
AddColumn("dbo.Topic", "IsPublished", c => c.Boolean(nullable: false, defaultValue: true));
15+
CreateIndex("dbo.Customer", "CustomerNumber", name: "IX_Customer_CustomerNumber");
16+
}
17+
18+
public override void Down()
19+
{
20+
DropIndex("dbo.Customer", "IX_Customer_CustomerNumber");
21+
DropColumn("dbo.Topic", "IsPublished");
22+
DropColumn("dbo.Topic", "SubjectToAcl");
23+
DropColumn("dbo.Topic", "Intro");
24+
DropColumn("dbo.Topic", "ShortTitle");
25+
CreateIndex("dbo.Customer", "CustomerNumber", unique: true, name: "IX_Customer_CustomerNumber");
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)