Skip to content

Commit

Permalink
Fixed Error in merge strategy, fixed error ImportExport Workflows (At…
Browse files Browse the repository at this point in the history
…tribute missing)
  • Loading branch information
thomasM1978 committed Nov 30, 2022
1 parent c521a6e commit 3ab8471
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 12 additions & 4 deletions Signum.Engine.Extensions/Authorization/AuthLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ public static Lite<RoleEntity> GetOrCreateTrivialMergeRole(List<Lite<RoleEntity>
return db;

using (AuthLogic.Disable())
using (OperationLogic.AllowSave<RoleEntity>())
{
var result = new RoleEntity
{
Expand All @@ -231,7 +232,7 @@ public static Lite<RoleEntity> GetOrCreateTrivialMergeRole(List<Lite<RoleEntity>
Description = null,
IsTrivialMerge = true,
InheritsFrom = flatRoles.ToMList()
}.Execute(RoleOperation.Save);
}.Save();

return result.ToLite();
}
Expand Down Expand Up @@ -437,6 +438,7 @@ public static UserEntity RetrieveUser(string username, byte[] passwordHash)
using (AuthLogic.Disable())
{
UserEntity? user = RetrieveUser(username);

if (user == null)
throw new IncorrectUsernameException(LoginAuthMessage.Username0IsNotValid.NiceToString().FormatWith(username));

Expand Down Expand Up @@ -635,13 +637,19 @@ public static void LoadRoles(XDocument doc)
var roleInfos = doc.Root!.Element("Roles")!.Elements("Role").Select(x => new
{
Name = x.Attribute("Name")!.Value,
MergeStrategy = x.Attribute("MergeStrategy")?.Let(ms => ms.Value.ToEnum<MergeStrategy>()) ?? MergeStrategy.Union,
IsTrivialMerge = x.Attribute("IsTrivialMerge")?.Let(t => t.Value.ToBool()) ?? false,
MergeStrategy = x.Attribute("MergeStrategy")?.Value.ToEnum<MergeStrategy>() ?? MergeStrategy.Union,
IsTrivialMerge = x.Attribute("IsTrivialMerge")?.Value.ToBool() ?? false,
SubRoles = x.Attribute("Contains")!.Value.SplitNoEmpty(','),
Description = x.Attribute("Description")?.Value,
}).ToList();

var roles = roleInfos.ToDictionary(a => a.Name!, a => new RoleEntity { Name = a.Name!, MergeStrategy = a.MergeStrategy, Description = a.Description, });
var roles = roleInfos.ToDictionary(a => a.Name!, a => new RoleEntity
{
Name = a.Name!,
MergeStrategy = a.MergeStrategy,
IsTrivialMerge = a.IsTrivialMerge,
Description = a.Description,
});

foreach (var ri in roleInfos)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public XElement ToXml(IToXmlContext ctx)
e.Event.Name.HasText() ? new XAttribute("Name", e.Event.Name) : null!,
new XAttribute("Lane", e.Event.Lane.BpmnElementId),
new XAttribute("Type", e.Event.Type.ToString()),
e.Event.DecisionOptionName.HasText() ? new XAttribute("DecisionOptionName", e.Event.DecisionOptionName) : null,
e.Event.Timer == null ? null! : new XElement("Timer",
e.Event.Timer.Duration?.ToXml("Duration")!,
e.Event.Timer.Condition == null ? null! : new XAttribute("Condition", ctx.Include(e.Event.Timer.Condition))),
Expand Down Expand Up @@ -361,6 +362,7 @@ public void FromXml(XElement element, IFromXmlContext ctx)
ev.Name = xml.Attribute("Name")?.Value;
ev.Lane = this.lanes.GetOrThrow(xml.Attribute("Lane")!.Value);
ev.Type = xml.Attribute("Type")!.Value.ToEnum<WorkflowEventType>();
ev.DecisionOptionName = xml.Attribute("DecisionOptionName")?.Value;
ev.Timer = ev.Timer.CreateOrAssignEmbedded(xml.Element("Timer"), (time, xml) =>
{
time.Duration = time.Duration.CreateOrAssignEmbedded(xml.Element("Duration"), (ts, xml) => ts.FromXml(xml));
Expand Down

0 comments on commit 3ab8471

Please sign in to comment.