@@ -76,9 +76,13 @@ public TypeAuthCache(SchemaBuilder sb, IMerger<Type, TypeAllowedAndConditions> m
76
76
{
77
77
TypeConditionSymbol condition = (TypeConditionSymbol)arg;
78
78
79
-
var command = Administrator.UnsafeDeletePreCommandMList((RuleTypeEntity rt)=>rt.Conditions, Database.MListQuery((RuleTypeEntity rt) => rt.Conditions).Where(mle => mle.Element.Conditions.Contains(condition)));
79
+
if (!Database.MListQuery((RuleTypeConditionEntity rt) => rt.Conditions).Any(mle => mle.Element.Is(condition)))
80
+
return null;
80
81
81
-
return command;
82
+
var mlist = Administrator.UnsafeDeletePreCommandMList((RuleTypeConditionEntity rt)=>rt.Conditions, Database.MListQuery((RuleTypeConditionEntity rt) => rt.Conditions).Where(mle => mle.Element.Is(condition)));
83
+
var emptyRules = Administrator.UnsafeDeletePreCommand(Database.Query<RuleTypeConditionEntity>().Where(rt => rt.Conditions.Count == 0), force: true, avoidMList: true);
84
+
85
+
return SqlPreCommand.Combine(Spacing.Simple, mlist, emptyRules);
82
86
}
83
87
84
88
TypeAllowedAndConditions IManualAuth<Type, TypeAllowedAndConditions>.GetAllowed(Lite<RoleEntity> role, Type key)
@@ -327,7 +331,7 @@ orderby resource
327
331
new XAttribute("Allowed", allowed.Fallback.ToString()!),
328
332
from c in allowed.ConditionRules
329
333
select new XElement("Condition",
330
-
new XAttribute("Name", c.ToString()),
334
+
new XAttribute("Name", c.TypeConditions.ToString(", ")),
331
335
new XAttribute("Allowed", c.Allowed.ToString()))
332
336
)
333
337
)
@@ -351,7 +355,7 @@ from c in allowed.ConditionRules
351
355
TypeLogic.NameToType.Where(a => !a.Value.IsEnumEntity()).Select(a => a.Key).ToHashSet(), typeReplacementKey);
352
356
353
357
replacements.AskForReplacements(
354
-
xRoles.SelectMany(x => x.Elements("Type")).SelectMany(t => t.Elements("Condition")).SelectMany(x => x.Attribute("Name")!.Value.Split(" & ").ToList()).ToHashSet(),
358
+
xRoles.SelectMany(x => x.Elements("Type")).SelectMany(t => t.Elements("Condition")).SelectMany(x => x.Attribute("Name")!.Value.SplitNoEmpty(",").Select(a=>a.Trim()).ToList()).ToHashSet(),
355
359
SymbolLogic<TypeConditionSymbol>.AllUniqueKeys(),
356
360
typeConditionReplacementKey);
357
361
@@ -366,7 +370,7 @@ from c in allowed.ConditionRules
366
370
};
367
371
368
372
369
-
return Synchronizer.SynchronizeScript(Spacing.Double, should, current,
373
+
return Synchronizer.SynchronizeScript(Spacing.Triple, should, current,
370
374
createNew: (role, x) =>
371
375
{
372
376
var dic = (from xr in x.Elements("Type")
@@ -397,7 +401,7 @@ from c in allowed.ConditionRules
397
401
select KeyValuePair.Create(t, xr)).ToDictionaryEx("Type rules for {0}".FormatWith(role));
398
402
399
403
SqlPreCommand? restSql = Synchronizer.SynchronizeScript(
400
-
Spacing.Simple,
404
+
Spacing.Triple,
401
405
dic,
402
406
list.Where(a => a.Resource != null).ToDictionary(a => a.Resource),
403
407
createNew: (r, xr) =>
@@ -432,8 +436,8 @@ private static MList<RuleTypeConditionEntity> Conditions(XElement xr, Replacemen
432
436
var conditions = (from xc in xr.Elements("Condition")
433
437
select new RuleTypeConditionEntity
434
438
{
435
-
Conditions = xc.Attribute("Name")!.Value.Split(" & ")
436
-
.Select(s => SymbolLogic<TypeConditionSymbol>.TryToSymbol(replacements.Apply(typeConditionReplacementKey, s))).NotNull().ToMList(),
439
+
Conditions = xc.Attribute("Name")!.Value.SplitNoEmpty(",")
440
+
.Select(s => SymbolLogic<TypeConditionSymbol>.TryToSymbol(replacements.Apply(typeConditionReplacementKey, s.Trim()))).NotNull().ToMList(),
437
441
Allowed = xc.Attribute("Allowed")!.Value.ToEnum<TypeAllowed>()
438
442
}).ToMList();
439
443
return conditions;
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4