Exemple #1
0
        private static RbacEntitlement FromXml(string metaDataxml)
        {
            if (string.IsNullOrEmpty(metaDataxml))
            {
                return(null);
            }

            RbacEntitlement entitlements = new RbacEntitlement();
            XmlDocument     doc          = new XmlDocument();

            doc.LoadXml(metaDataxml);

            foreach (XmlNode node in doc.DocumentElement.ChildNodes)
            {
                if (node.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }
                else if (node.Name == "RbacEntitlementMenus")
                {
                    entitlements.Menus = RbacEntitlementMenus.FromXml(node);
                }
                if (node.Name == "RbacEntitlementScreens")
                {
                    entitlements.Screens = RbacEntitlementScreens.FromXml(node);
                }
            }
            return(entitlements);
        }
Exemple #2
0
        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;
            }
        }
Exemple #3
0
        public static RbacEntitlementScreens FromXml(XmlNode entitlementMenuNode)
        {
            RbacEntitlementScreens screens = new RbacEntitlementScreens();

            foreach (XmlNode node in entitlementMenuNode.ChildNodes)
            {
                if (node.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }
                else if (node.Name == "RbacEntitlementScreen")
                {
                    screens.Screens.Add(RbacEntitlementScreen.FromXml(node));
                }
            }
            return(screens);
        }
Exemple #4
0
 public static RbacEntitlementScreen Get(this RbacEntitlementScreens screens, string name)
 {
     return((from m in screens.Screens
             where m.Name.Equals(name, StringComparison.OrdinalIgnoreCase)
             select m).SingleOrDefault());
 }
Exemple #5
0
 public RbacEntitlement()
 {
     Menus   = new RbacEntitlementMenus();
     Screens = new RbacEntitlementScreens();
 }