Ejemplo n.º 1
0
        public WidgetBuilderUser(int userID)
            : base(userID)
        {
            this.userID = userID;

            config.Load(HttpContext.Current.Server.MapPath(WidgetBuilderCore.ConfigFilename));

            widgetPermissions=getUserWidgetPermissions();
        }
Ejemplo n.º 2
0
        private WidgetUserPermissions getUserWidgetPermissions()
        {
            WidgetUserPermissions permissions = new WidgetUserPermissions();

            XmlNode userNode=getUserPermissionNode();

            //Log.Add(LogTypes.Debug, 0, "user=>"+userNode.InnerXml);

            //add the widgets in
            foreach (XmlNode thisWidget in userNode.SelectNodes("widget"))
            {
                //Log.Add(LogTypes.Debug, 0, "widget");
                WidgetPermissions thisWidgetPermission = new WidgetPermissions();
                thisWidgetPermission.hide = Convert.ToBoolean(thisWidget.Attributes["hide"].Value);

                //add in the elements
                foreach(XmlNode thisElement in thisWidget.SelectNodes("element")){
                    //Log.Add(LogTypes.Debug, 0, "element");
                    thisWidgetPermission.elements.Add(thisElement.Attributes["name"].Value, new WidgetElementPermissions(){hide=Convert.ToBoolean(thisElement.Attributes["hide"].Value)});
                }

                permissions.widgets.Add(thisWidget.Attributes["id"].Value, thisWidgetPermission);
            }

            return permissions;
        }