Пример #1
0
        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();
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
 public static RbacRole Save(RbacRoleWeb rbacRoleWeb)
 {
     return(new DataManager.Manager().AddOrUpdate(RbacRoleWeb.Get(rbacRoleWeb)));
 }