forked from siteserver/cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigManager.cs
More file actions
149 lines (135 loc) · 5.25 KB
/
ConfigManager.cs
File metadata and controls
149 lines (135 loc) · 5.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
using SiteServer.CMS.Core;
using SiteServer.CMS.DataCache.Core;
using SiteServer.CMS.Model;
using SiteServer.CMS.Model.Attributes;
using SiteServer.Utils;
namespace SiteServer.CMS.DataCache
{
public static class ConfigManager
{
private static readonly string CacheKey = DataCacheManager.GetCacheKey(nameof(ConfigManager));
private static readonly object LockObject = new object();
public static class PluginsPermissions
{
public const string Add = "plugins_add";
public const string Management = "plugins_management";
}
public static class SettingsPermissions
{
public const string SiteAdd = "settings_siteAdd";
public const string Site = "settings_site";
public const string Admin = "settings_admin";
public const string User = "settings_user";
public const string Chart = "settings_chart";
public const string Log = "settings_log";
public const string Utility = "settings_utility";
}
public static class WebSitePermissions
{
public const string Content = "cms_content"; //信息管理
public const string Template = "cms_template"; //显示管理
public const string Configration = "cms_configration"; //设置管理
public const string Create = "cms_create"; //生成管理
}
public static class ChannelPermissions
{
public const string ContentView = "cms_contentView";
public const string ContentAdd = "cms_contentAdd";
public const string ContentEdit = "cms_contentEdit";
public const string ContentDelete = "cms_contentDelete";
public const string ContentTranslate = "cms_contentTranslate";
public const string ContentOrder = "cms_contentOrder";
public const string ChannelAdd = "cms_channelAdd";
public const string ChannelEdit = "cms_channelEdit";
public const string ChannelDelete = "cms_channelDelete";
public const string ChannelTranslate = "cms_channelTranslate";
public const string CreatePage = "cms_createPage";
public const string ContentCheck = "cms_contentCheck";
public const string ContentCheckLevel1 = "cms_contentCheckLevel1";
public const string ContentCheckLevel2 = "cms_contentCheckLevel2";
public const string ContentCheckLevel3 = "cms_contentCheckLevel3";
public const string ContentCheckLevel4 = "cms_contentCheckLevel4";
public const string ContentCheckLevel5 = "cms_contentCheckLevel5";
}
public static class TopMenu
{
public const string IdSite = "Site";
public const string IdPlugins = "Plugins";
public const string IdSettings = "Settings";
}
public static class LeftMenu
{
public const string IdContent = "Content";
public const string IdTemplate = "Template";
public const string IdConfigration = "Configration";
public const string IdCreate = "Create";
}
public static string GetTopMenuName(string menuId)
{
var retval = string.Empty;
if (menuId == TopMenu.IdSite)
{
retval = "站点管理";
}
else if (menuId == TopMenu.IdPlugins)
{
retval = "插件管理";
}
else if (menuId == TopMenu.IdSettings)
{
retval = "系统管理";
}
return retval;
}
public static string GetLeftMenuName(string menuId)
{
var retval = string.Empty;
if (menuId == LeftMenu.IdContent)
{
retval = "信息管理";
}
else if (menuId == LeftMenu.IdTemplate)
{
retval = "显示管理";
}
else if (menuId == LeftMenu.IdConfigration)
{
retval = "设置管理";
}
else if (menuId == LeftMenu.IdCreate)
{
retval = "生成管理";
}
return retval;
}
public static ConfigInfo Instance
{
get
{
var retval = DataCacheManager.Get<ConfigInfo>(CacheKey);
if (retval != null) return retval;
lock (LockObject)
{
retval = DataCacheManager.Get<ConfigInfo>(CacheKey);
if (retval == null)
{
retval = DataProvider.ConfigDao.GetConfigInfo();
DataCacheManager.Insert(CacheKey, retval);
}
}
return retval;
}
}
public static bool IsChanged
{
set
{
if (value)
{
DataCacheManager.Remove(CacheKey);
}
}
}
public static SystemConfigInfo SystemConfigInfo => Instance.SystemConfigInfo;
}
}