ModuleInitializer.cs
29.2 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
using System;
using System.Collections.Generic;
using System.Linq;
using Sungero.Core;
using Sungero.CoreEntities;
using Sungero.Domain.Initialization;
namespace DirRX.Storage.Server
{
public partial class ModuleInitializer
{
public override void Initializing(Sungero.Domain.ModuleInitializingEventArgs e)
{
SetDefaultSettings();
CreateRoles();
CreateDocumentTypes();
CreateDocumentKinds();
CreateApprovalRules();
GrantAccessRights();
CreateReportTables();
}
/// <summary>
/// Создать таблицы данных для отчетов.
/// </summary>
public static void CreateReportTables()
{
var annualSectionPermanentReportTableName = Constants.AnnualSectionElectronicPermanentReport.SourceTableName;
InitializationLogger.DebugFormat("Init: Create table {0}", annualSectionPermanentReportTableName);
var annualSectionTempReportTableName = Constants.AnnualSectionElectronicTempReport.SourceTableName;
InitializationLogger.DebugFormat("Init: Create table {0}", annualSectionTempReportTableName);
Sungero.Docflow.PublicFunctions.Module.DropReportTempTables(new[] { annualSectionPermanentReportTableName, annualSectionTempReportTableName });
Sungero.Docflow.PublicFunctions.Module.ExecuteSQLCommandFormat(Queries.AnnualSectionElectronicPermanentReport.CreateDataTable, new[] { annualSectionPermanentReportTableName });
Sungero.Docflow.PublicFunctions.Module.ExecuteSQLCommandFormat(Queries.AnnualSectionElectronicTempReport.CreateDataTable, new[] { annualSectionTempReportTableName });
}
/// <summary>
/// Создать типы документов.
/// </summary>
public static void CreateDocumentTypes()
{
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentType(Storage.FundsSheets.Info.LocalizedName,
FundsSheet.ClassTypeGuid,
Sungero.Docflow.DocumentType.DocumentFlow.Inner,
false);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentType(Storage.ArchiveDocuments.Info.LocalizedName,
ArchiveDocument.ClassTypeGuid,
Sungero.Docflow.DocumentType.DocumentFlow.Inner,
false);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentType(DestructionActs.Info.LocalizedName,
DestructionAct.ClassTypeGuid,
Sungero.Docflow.DocumentType.DocumentFlow.Inner,
true);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentType(Storage.FundsLists.Info.LocalizedName,
FundsList.ClassTypeGuid,
Sungero.Docflow.DocumentType.DocumentFlow.Inner,
true);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentType(Storage.AnnualSections.Info.LocalizedName,
AnnualSection.ClassTypeGuid,
Sungero.Docflow.DocumentType.DocumentFlow.Inner,
false);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentType(Storage.ConsolidatedInventoryLists.Info.LocalizedName,
ConsolidatedInventoryList.ClassTypeGuid,
Sungero.Docflow.DocumentType.DocumentFlow.Inner,
false);
}
/// <summary>
/// Задать настройки по умолчанию.
/// </summary>
public static void SetDefaultSettings()
{
var paramValue = Sungero.Docflow.PublicFunctions.Module.GetDocflowParamsValue(Constants.Module.DocflowParams.DaysBeforeImproveKey);
if (paramValue is DBNull || paramValue == null)
{
Storage.PublicFunctions.Module.Remote.SetMainSettings(365, 60, true);
}
}
/// <summary>
/// Создать роли.
/// </summary>
public static void CreateRoles()
{
Sungero.Docflow.PublicInitializationFunctions.Module.CreateRole(Resources.RoleExpertCommissionName, Resources.RoleExpertCommissionDescription, Constants.Module.Initialize.ExpertCommissionRoleGuid);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateRole(Resources.RoleSyncAdminName, Resources.RoleSyncAdminDescription, Constants.Module.Initialize.SyncAdminRoleGuid);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateRole(Resources.RoleResponsibleForProceduresName, Resources.RoleResponsibleForProceduresDescription, Constants.Module.Initialize.ResponsiblePeriodicProceduresRoleGuid);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateRole(Resources.RoleAllArchiveUsersName, Resources.RoleAllArchiveUsersDescription, Constants.Module.Initialize.AllArchiveUsersRoleGuid);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateRole(Resources.RoleArchiveUsersName, Resources.RoleArchiveUsersDescription, Constants.Module.Initialize.ArchiveUsersRoleGuid);
// В роль Все пользователи архива добавить роли - Архивист, Делопроизводители, Пользователи архива
var allArchiveUsersRole = Roles.GetAll(r => r.Sid == Constants.Module.Initialize.AllArchiveUsersRoleGuid).FirstOrDefault();
var guidRoles = new List<Guid>() { Constants.Module.Initialize.ArchiveUsersRoleGuid,
DirRX.CaseArchiving.PublicConstants.Module.Initialize.ClerksRole,
DirRX.CaseArchiving.PublicConstants.Module.Initialize.ArchivistRoleGuid };
var roles = Roles.GetAll(r => guidRoles.Contains(r.Sid.Value));
foreach (var role in roles)
{
if (!allArchiveUsersRole.RecipientLinks.Any(r => Equals(r.Member, role)))
allArchiveUsersRole.RecipientLinks.AddNew().Member = role;
}
allArchiveUsersRole.Save();
// Руководитель архива.
var roleArchiveManager = Sungero.Docflow.PublicInitializationFunctions.Module.CreateRole(Resources.RoleArchiveManagerName, Resources.RoleManagerArchiveUsersDescription, Constants.Module.Initialize.ArchiveManagerRoleGuid);
if (roleArchiveManager.IsSingleUser != true)
{
roleArchiveManager.IsSingleUser = true;
roleArchiveManager.RecipientLinks.AddNew().Member = Users.Current;
roleArchiveManager.Save();
}
}
/// <summary>
/// Создать виды документов.
/// </summary>
public static void CreateDocumentKinds()
{
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentKind(Resources.InitDestructionActDocumentKindName,
Resources.InitDestructionActDocumentKindName,
Sungero.Docflow.DocumentKind.NumberingType.Numerable,
Sungero.Docflow.DocumentKind.DocumentFlow.Inner,
true, false, DestructionAct.ClassTypeGuid, null,
Constants.Module.Initialize.DestructionActDocumentKind, true);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentKind(Resources.InitFundsListDocumentKindName,
Resources.InitFundsListDocumentKindName,
Sungero.Docflow.DocumentKind.NumberingType.Numerable,
Sungero.Docflow.DocumentKind.DocumentFlow.Inner,
true, false, FundsList.ClassTypeGuid, null,
Constants.Module.Initialize.FundsListDocumentKind, true);
// Для годовых разделов.
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentKind(Resources.AnnualSectionPermanentDocumentKindName,
Resources.AnnualSectionPermanentDocumentKindName,
Sungero.Docflow.DocumentKind.NumberingType.NotNumerable,
Sungero.Docflow.DocumentKind.DocumentFlow.Inner,
false, false, AnnualSection.ClassTypeGuid,
new Sungero.Domain.Shared.IActionInfo[] { Sungero.Docflow.OfficialDocuments.Info.Actions.SendForApproval },
Constants.Module.Initialize.AnnualSectionPermanentDocumentKind, false);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentKind(Resources.AnnualSectionTempDocumentKindName,
Resources.AnnualSectionTempDocumentKindName,
Sungero.Docflow.DocumentKind.NumberingType.NotNumerable,
Sungero.Docflow.DocumentKind.DocumentFlow.Inner,
false, false, AnnualSection.ClassTypeGuid,
new Sungero.Domain.Shared.IActionInfo[] { Sungero.Docflow.OfficialDocuments.Info.Actions.SendForApproval },
Constants.Module.Initialize.AnnualSectionTempDocumentKind, false);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentKind(Resources.InitArchivalReferenceDocumentKindName,
Resources.InitArchivalReferenceDocumentKindName,
Sungero.Docflow.DocumentKind.NumberingType.Numerable,
Sungero.Docflow.DocumentKind.DocumentFlow.Inner,
true, false, Constants.Module.Initialize.SimpleDocumentTypeGuid,
null, Constants.Module.Initialize.ArchivalReferenceDocumentKind, true);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentKind(Resources.InitArchiveExtractDocumentKindName,
Resources.InitArchiveExtractDocumentKindName,
Sungero.Docflow.DocumentKind.NumberingType.Numerable,
Sungero.Docflow.DocumentKind.DocumentFlow.Inner,
true, false, Constants.Module.Initialize.SimpleDocumentTypeGuid,
null, Constants.Module.Initialize.ArchiveExtractDocumentKind, true);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentKind(Resources.AnnualSectionDocumentKindName,
Resources.AnnualSectionDocumentKindName,
Sungero.Docflow.DocumentKind.NumberingType.NotNumerable,
Sungero.Docflow.DocumentKind.DocumentFlow.Inner,
false, false, AnnualSection.ClassTypeGuid,
new Sungero.Domain.Shared.IActionInfo[] { Sungero.Docflow.OfficialDocuments.Info.Actions.SendForApproval },
Constants.Module.Initialize.AnnualSectionTempDocumentKind, true);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentKind(Resources.AnnualSectionPersonalDocumentKindName,
Resources.AnnualSectionPersonalDocumentKindName,
Sungero.Docflow.DocumentKind.NumberingType.NotNumerable,
Sungero.Docflow.DocumentKind.DocumentFlow.Inner,
false, false, AnnualSection.ClassTypeGuid,
new Sungero.Domain.Shared.IActionInfo[] { Sungero.Docflow.OfficialDocuments.Info.Actions.SendForApproval },
Constants.Module.Initialize.AnnualSectionPersonalDocumentKind, false);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentKind(Resources.AnnualSectionElectronicPermanentDocumentKindName,
Resources.AnnualSectionElectronicPermanentDocumentKindName,
Sungero.Docflow.DocumentKind.NumberingType.NotNumerable,
Sungero.Docflow.DocumentKind.DocumentFlow.Inner,
false, false, AnnualSection.ClassTypeGuid,
new Sungero.Domain.Shared.IActionInfo[] { Sungero.Docflow.OfficialDocuments.Info.Actions.SendForApproval },
Constants.Module.Initialize.AnnualSectionElectronicPermanentDocumentKind, false);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentKind(Resources.AnnualSectionElectronicTempDocumentKindName,
Resources.AnnualSectionElectronicTempDocumentKindName,
Sungero.Docflow.DocumentKind.NumberingType.NotNumerable,
Sungero.Docflow.DocumentKind.DocumentFlow.Inner,
false, false, AnnualSection.ClassTypeGuid,
new Sungero.Domain.Shared.IActionInfo[] { Sungero.Docflow.OfficialDocuments.Info.Actions.SendForApproval },
Constants.Module.Initialize.AnnualSectionElectronicTempDocumentKind, false);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentKind(Resources.ConsolidatedInventoryListDocumentKindName,
Resources.ConsolidatedInventoryListDocumentKindName,
Sungero.Docflow.DocumentKind.NumberingType.NotNumerable,
Sungero.Docflow.DocumentKind.DocumentFlow.Inner,
false, false, ConsolidatedInventoryList.ClassTypeGuid, null,
Constants.Module.Initialize.ConsolidatedInventoryListDocumentKind, true);
Sungero.Docflow.PublicInitializationFunctions.Module.CreateDocumentKind(Resources.InitFundsSheetDocumentKindName,
Resources.InitFundsSheetDocumentKindName,
Sungero.Docflow.DocumentKind.NumberingType.NotNumerable,
Sungero.Docflow.DocumentKind.DocumentFlow.Inner,
true, false, FundsSheet.ClassTypeGuid, null,
Constants.Module.Initialize.FundsSheetDocumentKind, true);
}
/// <summary>
/// Создать правило согласования для акта о выделении дел к уничтожению.
/// </summary>
public static void CreateApprovalRules()
{
InitializationLogger.DebugFormat("Init: Create approval rule {0}", Resources.RuleDestructionActDefaultRuleName);
var destructionActDocumentKinds = PublicFunctions.Module.Remote.GetDestructionActDocumentKinds().ToList();
// Проверить нет ли уже правила по умолчанию для актов.
if (!Sungero.Docflow.ApprovalRuleBases.GetAll(r => r.IsDefaultRule == true && r.DocumentFlow == Sungero.Docflow.ApprovalRuleBase.DocumentFlow.Inner)
.Any(r => r.DocumentKinds.Any(d => destructionActDocumentKinds.Contains(d.DocumentKind))))
{
// Создать правило, заполнить карточку.
var rule = Sungero.Docflow.ApprovalRules.Create();
rule.Status = Sungero.Docflow.ApprovalRuleBase.Status.Active;
rule.Name = Resources.RuleDestructionActDefaultRuleName;
rule.DocumentFlow = Sungero.Docflow.ApprovalRuleBase.DocumentFlow.Inner;
rule.ReworkDeadline = 2;
rule.IsDefaultRule = true;
if (destructionActDocumentKinds != null)
foreach (var item in destructionActDocumentKinds)
rule.DocumentKinds.AddNew().DocumentKind = item;
// Добавить этап согласования с экспертной комиссией.
var stage = Sungero.Docflow.ApprovalStages.GetAll().FirstOrDefault(s => s.StageType == Sungero.Docflow.ApprovalStage.StageType.Approvers &&
s.Name == Sungero.Docflow.Resources.ApproveAdditionalApprovers);
rule.Stages.AddNew().Stage = stage;
// Добавить этап подписания.
var stageSign = Sungero.Docflow.ApprovalStages.Create();
stageSign.StageType = Sungero.Docflow.ApprovalStage.StageType.Sign;
stageSign.Name = Resources.RuleSigningStageName;
stageSign.DeadlineInDays = 2;
stageSign.NeedStrongSign = false;
rule.Stages.AddNew().Stage = stageSign;
// Добавить этап уведомления инициатора.
var stageNotice = Sungero.Docflow.ApprovalStages.GetAll().FirstOrDefault(s => s.StageType == Sungero.Docflow.ApprovalStage.StageType.Notice &&
s.Name == Sungero.Docflow.Resources.SignedNoticeName);
rule.Stages.AddNew().Stage = stageNotice;
Sungero.Docflow.PublicFunctions.ApprovalRuleBase.CreateAutoTransitions(rule);
rule.Save();
}
#region Правило согласования для годовых разделов.
InitializationLogger.DebugFormat("Init: Create approval rule {0}", DirRX.Storage.Resources.AnnualSectionApprovalRuleName);
var annualSectionDocumentKinds = PublicFunctions.Module.Remote.GetAnnualSectionDocumentKinds().ToList();
if (!Sungero.Docflow.ApprovalRuleBases.GetAll(r => r.IsDefaultRule == true && r.DocumentFlow == Sungero.Docflow.ApprovalRuleBase.DocumentFlow.Inner)
.Any(r => r.DocumentKinds.Any(d => annualSectionDocumentKinds.Contains(d.DocumentKind))))
{
var ruleAnnualSection = Sungero.Docflow.ApprovalRules.Create();
ruleAnnualSection.Status = Sungero.Docflow.ApprovalRuleBase.Status.Active;
ruleAnnualSection.Name = Resources.AnnualSectionApprovalRuleName;
ruleAnnualSection.DocumentFlow = Sungero.Docflow.ApprovalRuleBase.DocumentFlow.Inner;
ruleAnnualSection.ReworkDeadline = 2;
ruleAnnualSection.IsDefaultRule = true;
foreach (var item in annualSectionDocumentKinds)
ruleAnnualSection.DocumentKinds.AddNew().DocumentKind = item;
// Этап согласования с руководителем архива.
var stageArchive = Sungero.Docflow.ApprovalStages.Create();
stageArchive.StageType = Sungero.Docflow.ApprovalStage.StageType.Approvers;
stageArchive.Name = Resources.RuleApprovingHeadArchiveName;
stageArchive.DeadlineInDays = 1;
stageArchive.NeedStrongSign = false;
stageArchive.Recipients.AddNew().Recipient = Roles.GetAll().FirstOrDefault(x => x.Sid == Constants.Module.Initialize.ArchiveManagerRoleGuid);
stageArchive.Save();
ruleAnnualSection.Stages.AddNew().Stage = stageArchive;
// Этап согласования с экспертной комиссией.
var stageExpert = Sungero.Docflow.ApprovalStages.Create();
stageExpert.StageType = Sungero.Docflow.ApprovalStage.StageType.Approvers;
stageExpert.Name = Resources.RuleApprovalWithExpertCommissionStageName;
stageExpert.DeadlineInDays = 1;
stageExpert.NeedStrongSign = false;
stageExpert.Recipients.AddNew().Recipient = Roles.GetAll().FirstOrDefault(x => x.Sid == Constants.Module.Initialize.ExpertCommissionRoleGuid);
stageExpert.Save();
ruleAnnualSection.Stages.AddNew().Stage = stageExpert;
// Этап подписания.
var stageManagerSign = Sungero.Docflow.ApprovalStages.GetAll().FirstOrDefault(s => s.StageType == Sungero.Docflow.ApprovalStage.StageType.Sign &&
s.Name == Resources.RuleSigningStageName);
ruleAnnualSection.Stages.AddNew().Stage = stageManagerSign;
Sungero.Docflow.PublicFunctions.ApprovalRuleBase.CreateAutoTransitions(ruleAnnualSection);
ruleAnnualSection.Save();
}
#endregion
}
/// <summary>
/// Выдать права.
/// </summary>
public static void GrantAccessRights()
{
InitializationLogger.DebugFormat("Init: Grant access rights");
var allUsers = Roles.AllUsers;
if (allUsers != null)
{
// Право на создание описи - всем.
CaseArchiving.CaseInventories.AccessRights.Grant(allUsers, DefaultAccessRightsTypes.Create);
// Право на создание акта - всем.
Storage.DestructionActs.AccessRights.Grant(allUsers, DefaultAccessRightsTypes.Create);
Storage.DestructionActs.AccessRights.Save();
// Право на чтение журнала - всем.
Storage.ArchiveEventLogs.AccessRights.Grant(allUsers, DefaultAccessRightsTypes.Read);
Storage.ArchiveEventLogs.AccessRights.Save();
// Право на создание задачи на верификацию - всем.
Storage.VerificationActTasks.AccessRights.Grant(allUsers, DefaultAccessRightsTypes.Create);
Storage.VerificationActTasks.AccessRights.Save();
// Права на папки
Storage.SpecialFolders.FolderCaseFilesInWork.AccessRights.Grant(allUsers, DefaultAccessRightsTypes.Read);
Storage.SpecialFolders.FolderCaseFilesInWork.AccessRights.Save();
Storage.SpecialFolders.FolderTransferEventLog.AccessRights.Grant(allUsers, DefaultAccessRightsTypes.Read);
Storage.SpecialFolders.FolderTransferEventLog.AccessRights.Save();
}
// Право на интеграционные справочники - ответственному из роли.
var integrationAdminRole = Roles.GetAll(x => x.Sid == Constants.Module.Initialize.SyncAdminRoleGuid).FirstOrDefault();
if (integrationAdminRole != null)
{
Storage.CaseFileRules.AccessRights.Grant(integrationAdminRole, DefaultAccessRightsTypes.FullAccess);
Storage.CaseFileRules.AccessRights.Save();
Storage.ExternalSystems.AccessRights.Grant(integrationAdminRole, DefaultAccessRightsTypes.FullAccess);
Storage.ExternalSystems.AccessRights.Save();
Storage.ExternalEntities.AccessRights.Grant(integrationAdminRole, DefaultAccessRightsTypes.FullAccess);
Storage.ExternalEntities.AccessRights.Save();
DirRX.LongTermArchive.ExternalEntityLinks.AccessRights.Grant(integrationAdminRole, DefaultAccessRightsTypes.FullAccess);
DirRX.LongTermArchive.ExternalEntityLinks.AccessRights.Save();
Storage.SyncDatas.AccessRights.Grant(integrationAdminRole, DefaultAccessRightsTypes.FullAccess);
Storage.SyncDatas.AccessRights.Save();
}
// Право на изменение дел и полные права на сводные описи, годовые разделы и листы фонда - архивисту.
var archivistRole = Roles.GetAll(x => x.Sid == CaseArchiving.PublicConstants.Module.Initialize.ArchivistRoleGuid).FirstOrDefault();
if (archivistRole != null)
{
LongTermArchive.CaseFiles.AccessRights.Grant(archivistRole, DefaultAccessRightsTypes.Change);
LongTermArchive.CaseFiles.AccessRights.Save();
Storage.ConsolidatedInventories.AccessRights.Grant(archivistRole, DefaultAccessRightsTypes.FullAccess);
Storage.ConsolidatedInventories.AccessRights.Save();
Storage.ConsolidatedInventories.AccessRights.Grant(archivistRole, DefaultAccessRightsTypes.FullAccess);
Storage.ConsolidatedInventories.AccessRights.Save();
Storage.AnnualSections.AccessRights.Grant(archivistRole, DefaultAccessRightsTypes.FullAccess);
Storage.AnnualSections.AccessRights.Save();
Storage.ConsolidatedInventoryLists.AccessRights.Grant(archivistRole, DefaultAccessRightsTypes.FullAccess);
Storage.ConsolidatedInventoryLists.AccessRights.Save();
Storage.FundsSheets.AccessRights.Grant(archivistRole, DefaultAccessRightsTypes.FullAccess);
Storage.FundsSheets.AccessRights.Save();
Storage.FundsLists.AccessRights.Grant(archivistRole, DefaultAccessRightsTypes.FullAccess);
Storage.FundsLists.AccessRights.Save();
Storage.Funds.AccessRights.Grant(archivistRole, DefaultAccessRightsTypes.FullAccess);
Storage.Funds.AccessRights.Save();
Storage.SpecialFolders.FolderCaseFilesInArchive.AccessRights.Grant(archivistRole, DefaultAccessRightsTypes.FullAccess);
Storage.SpecialFolders.FolderCaseFilesInArchive.AccessRights.Save();
Storage.SpecialFolders.FolderCaseFileToConsInvent.AccessRights.Grant(archivistRole, DefaultAccessRightsTypes.FullAccess);
Storage.SpecialFolders.FolderCaseFileToConsInvent.AccessRights.Save();
}
// Право на просмотр фондов и листов фонда - всем пользователям архива.
var allArchiveUsersRole = Roles.GetAll(r => r.Sid == Constants.Module.Initialize.AllArchiveUsersRoleGuid).FirstOrDefault();
if (allArchiveUsersRole != null)
{
Storage.FundsSheets.AccessRights.Grant(allArchiveUsersRole, DefaultAccessRightsTypes.Read);
Storage.FundsSheets.AccessRights.Save();
Storage.Funds.AccessRights.Grant(allArchiveUsersRole, DefaultAccessRightsTypes.Read);
Storage.Funds.AccessRights.Save();
// Право на создание задачи на обработку запроса.
Storage.RequestProcessingTasks.AccessRights.Grant(allArchiveUsersRole, DefaultAccessRightsTypes.Create);
Storage.RequestProcessingTasks.AccessRights.Save();
}
}
}
}