public static TypeRulePack GetTypeRules(Lite <RoleEntity> roleLite) { var result = new TypeRulePack { Role = roleLite }; Schema s = Schema.Current; cache.GetRules(result, TypeLogic.TypeToEntity.Where(t => !t.Key.IsEnumEntity() && s.IsAllowed(t.Key, false) == null).Select(a => a.Value)); foreach (TypeAllowedRule r in result.Rules) { Type type = TypeLogic.EntityToType[r.Resource]; if (OperationAuthLogic.IsStarted) { r.Operations = OperationAuthLogic.GetAllowedThumbnail(roleLite, type); } if (PropertyAuthLogic.IsStarted) { r.Properties = PropertyAuthLogic.GetAllowedThumbnail(roleLite, type); } if (QueryAuthLogic.IsStarted) { r.Queries = QueryAuthLogic.GetAllowedThumbnail(roleLite, type); } } return(result); }
private void btSave_Click(object sender, RoutedEventArgs e) { TypeRulePack trp = (TypeRulePack)DataContext; trp.Rules = ((List <NamespaceNode>)treeView.ItemsSource).SelectMany(a => a.SubNodes).Select(a => a.ToRule()).ToMList(); Server.Execute((ITypeAuthServer s) => s.SetTypesRules(trp)); Load(); }
private void Load() { this.Title = AuthMessage._0RulesFor1.NiceToString().FormatWith(typeof(TypeEntity).NiceName(), Role); TypeRulePack trp = Server.Return((ITypeAuthServer s) => s.GetTypesRules(Role)); DataContext = trp; treeView.ItemsSource = (from r in trp.Rules group r by r.Resource.Namespace into g orderby g.Key select new NamespaceNode { Name = g.Key, SubNodes = g.OrderBy(a => a.Resource.ClassName).Select(a => new TypeRuleBuilder(a)).ToList() }).ToList(); }
public static void SetTypeRules(TypeRulePack rules) { cache.SetRules(rules); }
public void SetTypesRules(TypeRulePack rules) { Execute(MethodInfo.GetCurrentMethod(), () => TypeAuthLogic.SetTypeRules(rules)); }
public void SetTypeRules([Required, FromBody] TypeRulePack rules) { BasicPermission.AdminRules.AssertAuthorized(); TypeAuthLogic.SetTypeRules(rules); }
public void SetTypeRules(TypeRulePack rules) { BasicPermission.AdminRules.AssertAuthorized(); TypeAuthLogic.SetTypeRules(rules); }