Ejemplo n.º 1
0
        internal static int AddDesktopModuleToPortal(int portalId, int desktopModuleId, bool addPermissions, bool clearCache)
        {
            try
            {
                int portalDesktopModuleID;
                PortalDesktopModuleInfo portalDesktopModule = GetPortalDesktopModule(portalId, desktopModuleId);
                if (portalDesktopModule == null)
                {
                    portalDesktopModuleID = DataProvider.Instance().AddPortalDesktopModule(portalId, desktopModuleId, UserController.Instance.GetCurrentUserInfo().UserID);
                    EventLogController.Instance.AddLog(
                        "PortalDesktopModuleID",
                        portalDesktopModuleID.ToString(),
                        PortalController.Instance.GetCurrentPortalSettings(),
                        UserController.Instance.GetCurrentUserInfo().UserID,
                        EventLogController.EventLogType.PORTALDESKTOPMODULE_CREATED);
                    if (addPermissions)
                    {
                        ArrayList permissions = PermissionController.GetPermissionsByPortalDesktopModule();
                        if (permissions.Count > 0)
                        {
                            var        permission = permissions[0] as PermissionInfo;
                            PortalInfo objPortal  = PortalController.Instance.GetPortal(portalId);
                            if (permission != null && objPortal != null)
                            {
                                var desktopModulePermission = new DesktopModulePermissionInfo(permission)
                                {
                                    RoleID = objPortal.AdministratorRoleId, AllowAccess = true, PortalDesktopModuleID = portalDesktopModuleID
                                };
                                DesktopModulePermissionController.AddDesktopModulePermission(desktopModulePermission);
                            }
                        }
                    }
                }
                else
                {
                    portalDesktopModuleID = portalDesktopModule.PortalDesktopModuleID;
                }

                if (clearCache)
                {
                    DataCache.ClearPortalCache(portalId, true);
                }

                return(portalDesktopModuleID);
            }
            catch (Exception e)
            {
                LogError(e);
                throw;
            }
        }
Ejemplo n.º 2
0
        private void BindPermissions()
        {
            PortalDesktopModuleInfo portalModule = DesktopModuleController.GetPortalDesktopModule(ModuleContext.PortalSettings.PortalId, DesktopModule.DesktopModuleID);

            if (portalModule != null)
            {
                dgPermissions.PortalDesktopModuleID = portalModule.PortalDesktopModuleID;
                bool isVisible =
                    DesktopModulePermissionController.HasDesktopModulePermission(DesktopModulePermissionController.GetDesktopModulePermissions(portalModule.PortalDesktopModuleID), "DEPLOY") ||
                    ModuleContext.PortalSettings.UserInfo.IsInRole(ModuleContext.PortalSettings.AdministratorRoleName) || ModuleContext.PortalSettings.UserInfo.IsSuperUser;
                pnlPermissions.Visible = isVisible;
                if (!isVisible)
                {
                    lblHelp.Text = Localization.GetString("NoPermission", LocalResourceFile);
                }
            }
        }