Search in sources :

Example 6 with BaseSecurityModule

use of org.olat.basesecurity.BaseSecurityModule in project openolat by klemens.

the class BaseFullWebappController method initializeBase.

private void initializeBase(UserRequest ureq, WindowManager winman, ComponentCollection mainPanel) {
    // component-id of mainPanel for the window id
    mainVc.contextPut("o_winid", mainPanel.getDispatchID());
    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    mainVc.contextPut("enforceTopFrame", securityModule.isForceTopFrame());
    // add optional css classes
    mainVc.contextPut("bodyCssClasses", bodyCssClasses);
    Window w = wbo.getWindow();
    mainVc.put("jsCssRawHtmlHeader", w.getJsCssRawHtmlHeader());
    // control part for ajax-communication. returns an empty panel if ajax
    // is not enabled, so that ajax can be turned on on the fly for
    // development mode
    jsServerC = wbo.createAJAXController(ureq);
    mainVc.put("jsServer", jsServerC.getInitialComponent());
    // init with no bookmark (=empty bc)
    mainVc.contextPut("o_bc", "");
    mainVc.contextPut("o_serverUri", Settings.createServerURI());
    // the current language; used e.g. by screenreaders
    mainVc.contextPut("lang", ureq.getLocale().toString());
    // some user properties
    if (ureq.getUserSession().isAuthenticated()) {
        Identity ident = ureq.getIdentity();
        StringBuilder sb = new StringBuilder();
        sb.append("{ identity : ").append(ident.getKey());
        User user = ident.getUser();
        List<UserPropertyHandler> userPropertyHandlers = userManager.getUserPropertyHandlersFor(USER_PROPS_ID, ureq.getUserSession().getRoles().isOLATAdmin());
        for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
            String escapedValue = StringHelper.escapeJavaScript(userPropertyHandler.getUserProperty(user, getLocale()));
            sb.append(", ").append(userPropertyHandler.getName()).append(" : \"").append(escapedValue).append("\"");
        }
        sb.append("}");
        mainVc.contextPut("userJSON", sb);
    }
    // the current GUI theme and the global settings that contains the
    // font-size. both are pushed as objects so that window.dirty always reads
    // out the correct value
    mainVc.contextPut("theme", w.getGuiTheme());
    mainVc.contextPut("globalSettings", winman.getGlobalSettings());
    // also add the optional theme javascript
    addThemeJS();
    // Add JS analytics code, e.g. for google analytics
    if (analyticsModule.isAnalyticsEnabled()) {
        AnalyticsSPI analyticsSPI = analyticsModule.getAnalyticsProvider();
        mainVc.contextPut("analytics", analyticsSPI.analyticsInitPageJavaScript());
    }
    // content panel
    contentPanel = new Panel("olatContentPanel");
    mainVc.put("olatContentPanel", contentPanel);
    mainVc.contextPut("o_winid", w.getDispatchID());
    mainVc.contextPut("buildversion", Settings.getVersion());
    if (wbo.isDebuging()) {
        debugC = wbo.createDebugDispatcherController(ureq, getWindowControl());
        mainVc.put("guidebug", debugC.getInitialComponent());
    }
    // Inline translation interceptor. when the translation tool is enabled it
    // will start the translation tool in translation mode, if the overlay
    // feature is enabled it will start in customizing mode
    // fxdiff: allow user-managers to use the inline translation also.
    UserSession usess = ureq.getUserSession();
    if (usess.isAuthenticated() && (usess.getRoles().isOLATAdmin() || usess.getRoles().isUserManager()) && (i18nModule.isTransToolEnabled() || i18nModule.isOverlayEnabled())) {
        inlineTranslationC = wbo.createInlineTranslationDispatcherController(ureq, getWindowControl());
        Preferences guiPrefs = usess.getGuiPreferences();
        Boolean isInlineTranslationEnabled = (Boolean) guiPrefs.get(I18nModule.class, I18nModule.GUI_PREFS_INLINE_TRANSLATION_ENABLED, Boolean.FALSE);
        i18nManager.setMarkLocalizedStringsEnabled(usess, isInlineTranslationEnabled);
        mainVc.put("inlineTranslation", inlineTranslationC.getInitialComponent());
    }
    // debug info if debugging
    if (wbo.isDebuging()) {
        developmentC = wbo.createDevelopmentController(ureq, getWindowControl());
        mainVc.put("development", developmentC.getInitialComponent());
    }
    // put the global js translator mapper path into the main window
    mainVc.contextPut("jsTranslationMapperPath", BaseChiefController.jsTranslationMapperPath);
    // master window
    // w.addListener(this); // to be able to report "browser reload" to the user
    w.setContentPane(mainPanel);
}
Also used : Window(org.olat.core.gui.components.Window) I18nModule(org.olat.core.util.i18n.I18nModule) User(org.olat.core.id.User) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) AnalyticsSPI(org.olat.core.commons.services.analytics.AnalyticsSPI) OncePanel(org.olat.core.gui.components.panel.OncePanel) Panel(org.olat.core.gui.components.panel.Panel) StackedPanel(org.olat.core.gui.components.panel.StackedPanel) UserSession(org.olat.core.util.UserSession) Identity(org.olat.core.id.Identity) Preferences(org.olat.core.util.prefs.Preferences) UserPropertyHandler(org.olat.user.propertyhandlers.UserPropertyHandler)

Example 7 with BaseSecurityModule

use of org.olat.basesecurity.BaseSecurityModule in project openolat by klemens.

the class GroupController method init.

protected void init(UserRequest ureq, boolean mayModifyMembers, boolean keepAtLeastOne, boolean enableTablePreferences, boolean enableUserSelection, boolean allowDownload, boolean mandatoryEmail, SecurityGroup aSecurityGroup) {
    this.securityGroup = aSecurityGroup;
    this.mayModifyMembers = mayModifyMembers;
    this.keepAtLeastOne = keepAtLeastOne;
    this.mandatoryEmail = mandatoryEmail;
    securityManager = BaseSecurityManager.getInstance();
    imModule = CoreSpringFactory.getImpl(InstantMessagingModule.class);
    imService = CoreSpringFactory.getImpl(InstantMessagingService.class);
    userManager = CoreSpringFactory.getImpl(UserManager.class);
    sessionManager = CoreSpringFactory.getImpl(UserSessionManager.class);
    mailManager = CoreSpringFactory.getImpl(MailManager.class);
    Roles roles = ureq.getUserSession().getRoles();
    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    isAdministrativeUser = securityModule.isUserAllowedAdminProps(roles);
    chatEnabled = imModule.isEnabled() && imModule.isPrivateEnabled();
    // default group controller has no mail functionality
    this.addUserMailDefaultTempl = null;
    this.removeUserMailDefaultTempl = null;
    groupmemberview = createVelocityContainer("index");
    addUsersButton = LinkFactory.createButtonSmall("overview.addusers", groupmemberview, this);
    addUsersButton.setElementCssClass("o_sel_group_import_users");
    addUserButton = LinkFactory.createButtonSmall("overview.adduser", groupmemberview, this);
    addUserButton.setElementCssClass("o_sel_group_add_user");
    if (mayModifyMembers) {
        groupmemberview.contextPut("mayadduser", Boolean.TRUE);
    }
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setDownloadOffered(allowDownload);
    if (enableTablePreferences) {
        // save table preferences for each group seperatly
        if (mayModifyMembers) {
            tableConfig.setPreferencesOffered(true, "groupcontroller" + securityGroup.getKey());
        } else {
            // different rowcount...
            tableConfig.setPreferencesOffered(true, "groupcontrollerreadonly" + securityGroup.getKey());
        }
    }
    myTrans = userManager.getPropertyHandlerTranslator(getTranslator());
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), myTrans);
    listenTo(tableCtr);
    initGroupTable(tableCtr, ureq, enableTablePreferences, enableUserSelection);
    // set data model
    reloadData();
    groupmemberview.put("subjecttable", tableCtr.getInitialComponent());
    putInitialPanel(groupmemberview);
}
Also used : UserSessionManager(org.olat.core.util.session.UserSessionManager) UserManager(org.olat.user.UserManager) TableController(org.olat.core.gui.components.table.TableController) InstantMessagingService(org.olat.instantMessaging.InstantMessagingService) MailManager(org.olat.core.util.mail.MailManager) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) Roles(org.olat.core.id.Roles) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) InstantMessagingModule(org.olat.instantMessaging.InstantMessagingModule)

Example 8 with BaseSecurityModule

use of org.olat.basesecurity.BaseSecurityModule in project OpenOLAT by OpenOLAT.

the class CollaborationToolsFactory method initAvailableTools.

/**
 * Helper method to initialize the list of enabled tools based system wide
 * configuration.
 */
public synchronized void initAvailableTools() {
    ArrayList<String> toolArr = new ArrayList<String>();
    toolArr.add(CollaborationTools.TOOL_NEWS);
    toolArr.add(CollaborationTools.TOOL_CONTACT);
    CalendarModule calendarModule = CoreSpringFactory.getImpl(CalendarModule.class);
    if (calendarModule.isEnabled() && calendarModule.isEnableGroupCalendar()) {
        toolArr.add(CollaborationTools.TOOL_CALENDAR);
    }
    toolArr.add(CollaborationTools.TOOL_FOLDER);
    toolArr.add(CollaborationTools.TOOL_FORUM);
    if (CoreSpringFactory.getImpl(InstantMessagingModule.class).isEnabled()) {
        toolArr.add(CollaborationTools.TOOL_CHAT);
    }
    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    if (securityModule.isWikiEnabled()) {
        toolArr.add(CollaborationTools.TOOL_WIKI);
    }
    PortfolioModule portfolioModule = CoreSpringFactory.getImpl(PortfolioModule.class);
    PortfolioV2Module portfolioV2Module = CoreSpringFactory.getImpl(PortfolioV2Module.class);
    if (portfolioModule.isEnabled() || portfolioV2Module.isEnabled()) {
        toolArr.add(CollaborationTools.TOOL_PORTFOLIO);
    }
    OpenMeetingsModule openMeetingsModule = CoreSpringFactory.getImpl(OpenMeetingsModule.class);
    if (openMeetingsModule.isEnabled()) {
        toolArr.add(CollaborationTools.TOOL_OPENMEETINGS);
    }
    TOOLS = ArrayHelper.toArray(toolArr);
}
Also used : ArrayList(java.util.ArrayList) PortfolioV2Module(org.olat.modules.portfolio.PortfolioV2Module) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) CalendarModule(org.olat.commons.calendar.CalendarModule) OpenMeetingsModule(org.olat.modules.openmeetings.OpenMeetingsModule) InstantMessagingModule(org.olat.instantMessaging.InstantMessagingModule) PortfolioModule(org.olat.portfolio.PortfolioModule)

Example 9 with BaseSecurityModule

use of org.olat.basesecurity.BaseSecurityModule in project OpenOLAT by OpenOLAT.

the class GroupController method init.

protected void init(UserRequest ureq, boolean mayModifyMembers, boolean keepAtLeastOne, boolean enableTablePreferences, boolean enableUserSelection, boolean allowDownload, boolean mandatoryEmail, SecurityGroup aSecurityGroup) {
    this.securityGroup = aSecurityGroup;
    this.mayModifyMembers = mayModifyMembers;
    this.keepAtLeastOne = keepAtLeastOne;
    this.mandatoryEmail = mandatoryEmail;
    securityManager = BaseSecurityManager.getInstance();
    imModule = CoreSpringFactory.getImpl(InstantMessagingModule.class);
    imService = CoreSpringFactory.getImpl(InstantMessagingService.class);
    userManager = CoreSpringFactory.getImpl(UserManager.class);
    sessionManager = CoreSpringFactory.getImpl(UserSessionManager.class);
    mailManager = CoreSpringFactory.getImpl(MailManager.class);
    Roles roles = ureq.getUserSession().getRoles();
    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    isAdministrativeUser = securityModule.isUserAllowedAdminProps(roles);
    chatEnabled = imModule.isEnabled() && imModule.isPrivateEnabled();
    // default group controller has no mail functionality
    this.addUserMailDefaultTempl = null;
    this.removeUserMailDefaultTempl = null;
    groupmemberview = createVelocityContainer("index");
    addUsersButton = LinkFactory.createButtonSmall("overview.addusers", groupmemberview, this);
    addUsersButton.setElementCssClass("o_sel_group_import_users");
    addUserButton = LinkFactory.createButtonSmall("overview.adduser", groupmemberview, this);
    addUserButton.setElementCssClass("o_sel_group_add_user");
    if (mayModifyMembers) {
        groupmemberview.contextPut("mayadduser", Boolean.TRUE);
    }
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setDownloadOffered(allowDownload);
    if (enableTablePreferences) {
        // save table preferences for each group seperatly
        if (mayModifyMembers) {
            tableConfig.setPreferencesOffered(true, "groupcontroller" + securityGroup.getKey());
        } else {
            // different rowcount...
            tableConfig.setPreferencesOffered(true, "groupcontrollerreadonly" + securityGroup.getKey());
        }
    }
    myTrans = userManager.getPropertyHandlerTranslator(getTranslator());
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), myTrans);
    listenTo(tableCtr);
    initGroupTable(tableCtr, ureq, enableTablePreferences, enableUserSelection);
    // set data model
    reloadData();
    groupmemberview.put("subjecttable", tableCtr.getInitialComponent());
    putInitialPanel(groupmemberview);
}
Also used : UserSessionManager(org.olat.core.util.session.UserSessionManager) UserManager(org.olat.user.UserManager) TableController(org.olat.core.gui.components.table.TableController) InstantMessagingService(org.olat.instantMessaging.InstantMessagingService) MailManager(org.olat.core.util.mail.MailManager) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) Roles(org.olat.core.id.Roles) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration) InstantMessagingModule(org.olat.instantMessaging.InstantMessagingModule)

Example 10 with BaseSecurityModule

use of org.olat.basesecurity.BaseSecurityModule in project OpenOLAT by OpenOLAT.

the class GroupController method init.

protected void init(UserRequest ureq, boolean mayModifyMembers, boolean enableTablePreferences, boolean enableUserSelection, boolean allowDownload) {
    setTranslator(Util.createPackageTranslator(org.olat.admin.securitygroup.gui.GroupController.class, getLocale(), getTranslator()));
    Roles roles = ureq.getUserSession().getRoles();
    BaseSecurityModule securityModule = CoreSpringFactory.getImpl(BaseSecurityModule.class);
    isAdministrativeUser = securityModule.isUserAllowedAdminProps(roles);
    chatEnabled = imModule.isEnabled() && imModule.isPrivateEnabled();
    // default group controller has no mail functionality
    this.addUserMailDefaultTempl = null;
    this.removeUserMailDefaultTempl = null;
    groupmemberview = createVelocityContainer("index");
    addUsersButton = LinkFactory.createButtonSmall("overview.addusers", groupmemberview, this);
    addUsersButton.setElementCssClass("o_sel_group_import_users");
    addUserButton = LinkFactory.createButtonSmall("overview.adduser", groupmemberview, this);
    addUserButton.setElementCssClass("o_sel_group_add_user");
    if (mayModifyMembers) {
        groupmemberview.contextPut("mayadduser", Boolean.TRUE);
    }
    TableGuiConfiguration tableConfig = new TableGuiConfiguration();
    tableConfig.setDownloadOffered(allowDownload);
    if (enableTablePreferences) {
        // save table preferences for each group seperatly
        if (mayModifyMembers) {
            tableConfig.setPreferencesOffered(true, "groupcontroller" + group.getKey());
        } else {
            // different rowcount...
            tableConfig.setPreferencesOffered(true, "groupcontrollerreadonly" + group.getKey());
        }
    }
    myTrans = userManager.getPropertyHandlerTranslator(getTranslator());
    tableCtr = new TableController(tableConfig, ureq, getWindowControl(), myTrans);
    listenTo(tableCtr);
    initGroupTable(tableCtr, ureq, enableTablePreferences, enableUserSelection);
    // set data model
    reloadData();
    groupmemberview.put("subjecttable", tableCtr.getInitialComponent());
    putInitialPanel(groupmemberview);
}
Also used : TableController(org.olat.core.gui.components.table.TableController) BaseSecurityModule(org.olat.basesecurity.BaseSecurityModule) Roles(org.olat.core.id.Roles) TableGuiConfiguration(org.olat.core.gui.components.table.TableGuiConfiguration)

Aggregations

BaseSecurityModule (org.olat.basesecurity.BaseSecurityModule)12 TableController (org.olat.core.gui.components.table.TableController)4 TableGuiConfiguration (org.olat.core.gui.components.table.TableGuiConfiguration)4 Roles (org.olat.core.id.Roles)4 InstantMessagingModule (org.olat.instantMessaging.InstantMessagingModule)3 OpenMeetingsModule (org.olat.modules.openmeetings.OpenMeetingsModule)3 ArrayList (java.util.ArrayList)2 CollaborationTools (org.olat.collaboration.CollaborationTools)2 CalendarModule (org.olat.commons.calendar.CalendarModule)2 AnalyticsSPI (org.olat.core.commons.services.analytics.AnalyticsSPI)2 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)2 UserRequest (org.olat.core.gui.UserRequest)2 Window (org.olat.core.gui.components.Window)2 OncePanel (org.olat.core.gui.components.panel.OncePanel)2 Panel (org.olat.core.gui.components.panel.Panel)2 StackedPanel (org.olat.core.gui.components.panel.StackedPanel)2 TooledStackedPanel (org.olat.core.gui.components.stack.TooledStackedPanel)2 GenericTreeModel (org.olat.core.gui.components.tree.GenericTreeModel)2 GenericTreeNode (org.olat.core.gui.components.tree.GenericTreeNode)2 Controller (org.olat.core.gui.control.Controller)2