public virtual bool HasTabPermission(Security.Permissions.TabPermissionCollection objTabPermissions, string permissionKey)
 {
     return(PortalSecurity.IsInRoles(objTabPermissions.ToString(permissionKey)));
 }
예제 #2
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// AddHostPage adds a Host Tab Page
        /// </summary>
        ///	<param name="TabName">The Name to give this new Tab</param>
        ///	<param name="TabIconFile">The Icon for this new Tab</param>
        ///	<param name="IsVisible">A flag indicating whether the tab is visible</param>
        /// <history>
        /// [cnurse]	11/11/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public static TabInfo AddHostPage(string TabName, string Description, string TabIconFile, string TabIconFileLarge, bool IsVisible)
        {
            TabController objTabController = new TabController();
            TabInfo HostPage = objTabController.GetTabByName("Host", Null.NullInteger);

            if ((HostPage != null))
            {
                Security.Permissions.TabPermissionCollection objTabPermissions = new Security.Permissions.TabPermissionCollection();
                AddPagePermission(objTabPermissions, "View", Convert.ToInt32(Common.Globals.glbRoleSuperUser));
                AddPagePermission(objTabPermissions, "Edit", Convert.ToInt32(Common.Globals.glbRoleSuperUser));
                return AddPage(HostPage, TabName, Description, TabIconFile, TabIconFileLarge, IsVisible, objTabPermissions, true);
            }
            else
            {
                return null;
            }
        }
예제 #3
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// AddSearchResults adds a top level Hidden Search Results Page
        /// </summary>
        ///	<param name="ModuleDefId">The Module Deinition Id for the Search Results Module</param>
        /// <history>
        /// [cnurse]	11/11/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        private static void AddSearchResults(int ModuleDefId)
        {

            PortalController objPortals = new PortalController();
            PortalInfo objPortal = default(PortalInfo);
            ArrayList arrPortals = objPortals.GetPortals();
            int intPortal = 0;
            TabInfo newPage = default(TabInfo);

            //Add Page to Admin Menu of all configured Portals
            for (intPortal = 0; intPortal <= arrPortals.Count - 1; intPortal++)
            {
                Security.Permissions.TabPermissionCollection objTabPermissions = new Security.Permissions.TabPermissionCollection();

                objPortal = (PortalInfo)arrPortals[intPortal];

                AddPagePermission(objTabPermissions, "View", Convert.ToInt32(Common.Globals.glbRoleAllUsers));
                AddPagePermission(objTabPermissions, "View", Convert.ToInt32(objPortal.AdministratorRoleId));
                AddPagePermission(objTabPermissions, "Edit", Convert.ToInt32(objPortal.AdministratorRoleId));

                //Create New Page (or get existing one)
                newPage = AddPage(objPortal.PortalID, Null.NullInteger, "Search Results", "", "", "", false, objTabPermissions, false);

                //Add Module To Page
                AddModuleToPage(newPage, ModuleDefId, "Search Results", "");

            }
        }
예제 #4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// AddAdminPage adds an Admin Tab Page
        /// </summary>
        ///	<param name="Portal">The Portal</param>
        ///	<param name="TabName">The Name to give this new Tab</param>
        ///	<param name="TabIconFile">The Icon for this new Tab</param>
        ///	<param name="IsVisible">A flag indicating whether the tab is visible</param>
        /// <history>
        /// [cnurse]	11/11/2004	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public static TabInfo AddAdminPage(PortalInfo Portal, string TabName, string Description, string TabIconFile, string TabIconFileLarge, bool IsVisible)
        {

            TabController objTabController = new TabController();
            TabInfo AdminPage = objTabController.GetTab(Portal.AdminTabId, Portal.PortalID, false);

            if ((AdminPage != null))
            {
                Security.Permissions.TabPermissionCollection objTabPermissions = new Security.Permissions.TabPermissionCollection();
                AddPagePermission(objTabPermissions, "View", Convert.ToInt32(Portal.AdministratorRoleId));
                AddPagePermission(objTabPermissions, "Edit", Convert.ToInt32(Portal.AdministratorRoleId));
                return AddPage(AdminPage, TabName, Description, TabIconFile, TabIconFileLarge, IsVisible, objTabPermissions, true);
            }
            else
            {
                return null;

            }
        }