public void ParseMetaData() { if (this.CrudPermissions == null) { this.CrudPermissions = RbacMetaData.ReadPermissions(MetaDataRbac); } Parameters = this.CrudPermissions.SelectMany(t => t.Parameters).ToList(); this.Entitlement = new RbacEntitlement(this); }
/// <summary> /// This will refresh the rule from the meta data, byt merging latest changes from the database /// </summary> public void Refresh() { DataManager.Manager manager = new DataManager.Manager(false); List <RbacRole> roles = manager.GetRoles(this.RbacId); foreach (RbacRole role in roles) { role.MetaDataRbac = RbacMetaData.Merge(ConnectionString, role.MetaDataRbac); manager.AddOrUpdate(role); } }
public Rbac CreateNew(string rbacName, string description, string connectionString, string metaDataEntitlement) { DataManager.Manager manager = new DataManager.Manager(false); if (manager.GetRbac(rbacName) != null) { RbacException.Raise(string.Format("'{0}' already exists! Please provide a different name.", rbacName), RbacExceptionCategories.Repository); } Rbac newRbac = new Rbac(); newRbac.Name = rbacName; newRbac.Description = description; newRbac.ConnectionString = connectionString; N("Generating meta data..."); newRbac.MetaDataRbac = RbacMetaData.Generate(newRbac.ConnectionString); N("Done!", LogMessageTypes.Success); N("Saving your rbac instance..."); Rbac rbac = manager.AddOrUpdate(newRbac); N("Done!", LogMessageTypes.Success); return(rbac); }