private void InsertRoles(Rbac rbac) { string path = Path.Combine(_rootDir, "Books"); string entitlements = File.ReadAllText(Path.Combine(_rootDir, "Books", "entitlement.xml")); string[] roleFiles = Directory.GetFiles(path, "role_*.xml"); foreach (string roleFile in roleFiles) { string strRle = File.ReadAllText(roleFile); string strDescription = File.ReadAllText(Path.Combine(Path.GetDirectoryName(roleFile), Path.GetFileNameWithoutExtension(roleFile) + ".txt")); RbacRole role = rbac.CreateRole(Path.GetFileNameWithoutExtension(roleFile) , strDescription, strRle, entitlements); roles.Add(role); } }
private void InsertRoles(Rbac rbac) { string path = Path.Combine(_rootDir, "Books"); string[] roleFiles = Directory.GetFiles(path, "role_*.xml"); roleFiles = roleFiles.Where(rf => rf.Contains("_entitlement") == false).ToArray(); foreach (string roleFile in roleFiles) { string strRle = File.ReadAllText(roleFile); string onlyRoleFileName = Path.GetFileNameWithoutExtension(roleFile); string strDescription = File.ReadAllText(Path.Combine(Path.GetDirectoryName(roleFile), onlyRoleFileName + ".txt")); string strEntitlement = File.ReadAllText(Path.Combine(Path.GetDirectoryName(roleFile), onlyRoleFileName + "_entitlement.xml")); RbacRole role = rbac.CreateRole(Path.GetFileNameWithoutExtension(roleFile) , strDescription, strRle, strEntitlement); roles.Add(role); Console.Write("."); } }