public static void Export(this RbacRole role, string fileName) { RbacRoleWeb wRole = new RbacRoleWeb(role); StreamWriter sw = new StreamWriter(fileName); var s = new System.Xml.Serialization.XmlSerializer(wRole.GetType()); s.Serialize(sw, wRole); sw.Close(); }
public RbacUser(string userName, string fullName, string email, RbacRole role, string password = null) { RbacUser newUser = new RbacUser(); newUser.UserName = userName; newUser.FullName = fullName; newUser.Email = email; newUser.Role = role; newUser = new DataManager.Manager(false).AddOrUpdate(newUser); Assign(newUser); Parameters = new ObservableDictionary <string, string>(); }
public static RbacRole GetSample(Rbac rbac) { rbac = new DataManager.Manager(false).GetRbac(rbac.Name); RbacRole role = new RbacRole(); role.Name = "Sample Role"; role.Description = "Sample role description"; role.MetaDataEntitlements = rbac.MetaDataEntitlements; role.MetaDataRbac = rbac.MetaDataRbac; role.RbacId = rbac.RbacId; return(role); }
public static RbacRole Get(RbacRoleWeb rbacRoleWeb) { RbacRole role = new RbacRole(); role.RoleId = rbacRoleWeb.RoleId; role.RbacId = rbacRoleWeb.RbacId; role.Name = rbacRoleWeb.Name; role.Description = rbacRoleWeb.Description; role.MetaDataRbac = rbacRoleWeb.MetaDataRbac; role.MetaDataEntitlements = rbacRoleWeb.MetaDataEntitlements; role.Entitlement = rbacRoleWeb.Entitlement; role.CrudPermissions = rbacRoleWeb.CrudPermissions; return(role); }
private void Assign(RbacRole role) { if (role == null) { return; } this.RoleId = role.RoleId; this.RbacId = role.RbacId; this.Name = role.Name; this.Description = role.Description; this.MetaDataRbac = role.MetaDataRbac; this.MetaDataEntitlements = role.MetaDataEntitlements; this.Version = role.Version; }
public RbacEntitlement(RbacRole role) { if (role == null) { RbacException.Raise("A valid role is required to create entitlements!"); } RbacEntitlement entitlement = FromXml(role.MetaDataEntitlements); if (entitlement != null) { this.Menus = entitlement.Menus; this.Screens = entitlement.Screens; } }
public RbacRoleWeb(RbacRole role) { if (role == null) { return; } this.RoleId = role.RoleId; this.RbacId = role.RbacId; this.Name = role.Name; this.Description = role.Description; this.Entitlement = role.Entitlement; this.CrudPermissions = role.CrudPermissions; this.MetaDataRbac = role.MetaDataRbac; this.MetaDataEntitlements = role.MetaDataEntitlements; }
public static RbacRole ImportRole(this Rbac rbac, string fileName) { RbacRoleWeb wRole = null; StreamReader sr = new StreamReader(fileName); var s = new System.Xml.Serialization.XmlSerializer(typeof(RbacRoleWeb)); wRole = (RbacRoleWeb)s.Deserialize(sr); sr.Close(); if (wRole != null) { RbacRole role = new RbacRole(rbac.RbacId, wRole.Name, wRole.Description, wRole.MetaDataRbac, wRole.MetaDataEntitlements); return(role); } return(null); }
/// <summary> /// Instantiates a new Rbac Role /// </summary> /// <param name="rbacId">The rbac id it will belong to</param> /// <param name="name">Name of the new role</param> /// <param name="description">Description of the new role</param> /// <param name="metaDataRbac">Meta data of the role</param> /// <param name="metaDataEntitlements">Meta data of the entilements</param> public RbacRole(int rbacId, string name, string description, string metaDataRbac, string metaDataEntitlements) { if (rbacId == 0) { RbacException.Raise("Creation of role requires a valid rbacId!"); } Rbac rbac = new Framework.Rbac(); //create new role RbacRole newRole = new RbacRole(); newRole.RbacId = rbacId; newRole.Name = name; newRole.Description = description; newRole.MetaDataRbac = metaDataRbac; newRole.MetaDataEntitlements = metaDataEntitlements; newRole = new DataManager.Manager(false).AddOrUpdate(newRole); Assign(newRole); }
public static RbacUser CreateUser(string userName, string fullName, string email, string password, RbacRole role) { RbacUser user = new RbacUser(userName, fullName, email, role); ChangePassword(user.UserName, RbacCache.TempPassword, password); return(user); }