Search in sources :

Example 1 with IAbsSecurityManager

use of org.pentaho.di.ui.repository.pur.services.IAbsSecurityManager in project pentaho-kettle by pentaho.

the class AbsController method applySystemRoleActionPermission.

/**
 * Save the permission for the selected system role
 */
public void applySystemRoleActionPermission() {
    XulMessageBox messageBox = this.getMessageBox();
    IUIRole role = null;
    IUIAbsRole absRole = null;
    try {
        role = absSecurity.getSelectedSystemRole();
        if (role instanceof IUIAbsRole) {
            absRole = (IUIAbsRole) role;
        } else {
            throw new IllegalStateException();
        }
        ((IAbsSecurityManager) service).setLogicalRoles(absRole.getName(), absRole.getLogicalRoles());
        // $NON-NLS-1$
        messageBox.setTitle(BaseMessages.getString(PKG, "Dialog.Success"));
        // $NON-NLS-1$
        messageBox.setAcceptLabel(BaseMessages.getString(PKG, "Dialog.Ok"));
        // $NON-NLS-1$
        messageBox.setMessage(BaseMessages.getString(PKG, "AbsController.RoleActionPermission.Success"));
        messageBox.open();
        // Refresh permissions in open tabs
        SpoonPluginManager.getInstance().notifyLifecycleListeners(SpoonLifecycleListener.SpoonLifeCycleEvent.REPOSITORY_CHANGED);
    } catch (KettleException e) {
        // $NON-NLS-1$
        messageBox.setTitle(BaseMessages.getString(PKG, "Dialog.Error"));
        // $NON-NLS-1$
        messageBox.setAcceptLabel(BaseMessages.getString(PKG, "Dialog.Ok"));
        messageBox.setMessage(BaseMessages.getString(PKG, "AbsController.RoleActionPermission.UnableToApplyPermissions", role.getName(), // $NON-NLS-1$
        e.getLocalizedMessage()));
        messageBox.open();
    }
}
Also used : IUIAbsRole(org.pentaho.di.ui.repository.pur.repositoryexplorer.abs.IUIAbsRole) KettleException(org.pentaho.di.core.exception.KettleException) XulMessageBox(org.pentaho.ui.xul.components.XulMessageBox) IAbsSecurityManager(org.pentaho.di.ui.repository.pur.services.IAbsSecurityManager) IUIRole(org.pentaho.di.ui.repository.pur.repositoryexplorer.IUIRole)

Example 2 with IAbsSecurityManager

use of org.pentaho.di.ui.repository.pur.services.IAbsSecurityManager in project pentaho-kettle by pentaho.

the class AbsController method initializeLogicalSystemRolesUI.

/**
 * Initialized the ActionPermissions UI with all the possible values from LogicalSystemRoles enum
 */
private void initializeLogicalSystemRolesUI() {
    try {
        Map<String, String> logicalRoles = ((IAbsSecurityManager) service).getAllLogicalRoles(GlobalMessages.getLocale().getDisplayName());
        for (Entry<String, String> logicalRole : logicalRoles.entrySet()) {
            XulCheckbox logicalSystemRoleCheckbox;
            // $NON-NLS-1$
            logicalSystemRoleCheckbox = (XulCheckbox) document.createElement("checkbox");
            logicalSystemRoleCheckbox.setLabel(logicalRole.getValue());
            logicalSystemRoleCheckbox.setId(logicalRole.getValue());
            // $NON-NLS-1$
            logicalSystemRoleCheckbox.setCommand("iSecurityController.updateSystemRoleActionPermission()");
            logicalSystemRoleCheckbox.setFlex(1);
            logicalSystemRoleCheckbox.setDisabled(true);
            logicalSystemRolesBox.addChild(logicalSystemRoleCheckbox);
            logicalSystemRoleChecboxMap.put(logicalSystemRoleCheckbox, logicalRole.getKey());
            bf.setBindingType(Binding.Type.ONE_WAY);
            // $NON-NLS-1$ //$NON-NLS-2$
            bf.createBinding(systemRoleListBox, "selectedIndex", logicalSystemRoleCheckbox, "disabled", buttonConverter);
        }
    } catch (XulException xe) {
    } catch (KettleException xe) {
    }
}
Also used : XulCheckbox(org.pentaho.ui.xul.components.XulCheckbox) KettleException(org.pentaho.di.core.exception.KettleException) IAbsSecurityManager(org.pentaho.di.ui.repository.pur.services.IAbsSecurityManager) XulException(org.pentaho.ui.xul.XulException)

Example 3 with IAbsSecurityManager

use of org.pentaho.di.ui.repository.pur.services.IAbsSecurityManager in project pentaho-kettle by pentaho.

the class AbsController method initializeLogicalRolesUI.

/**
 * Initialized the ActionPermissions UI with all the possible values from LogicalRoles enum
 */
private void initializeLogicalRolesUI() {
    try {
        Map<String, String> logicalRoles = ((IAbsSecurityManager) service).getAllLogicalRoles(GlobalMessages.getLocale().getDisplayName());
        for (Entry<String, String> logicalRole : logicalRoles.entrySet()) {
            XulCheckbox logicalRoleCheckbox;
            // $NON-NLS-1$
            logicalRoleCheckbox = (XulCheckbox) document.createElement("checkbox");
            logicalRoleCheckbox.setLabel(logicalRole.getValue());
            logicalRoleCheckbox.setId(logicalRole.getValue());
            // $NON-NLS-1$
            logicalRoleCheckbox.setCommand("iSecurityController.updateRoleActionPermission()");
            logicalRoleCheckbox.setFlex(1);
            logicalRoleCheckbox.setDisabled(true);
            logicalRolesBox.addChild(logicalRoleCheckbox);
            logicalRoleChecboxMap.put(logicalRoleCheckbox, logicalRole.getKey());
            bf.setBindingType(Binding.Type.ONE_WAY);
            // $NON-NLS-1$ //$NON-NLS-2$
            bf.createBinding(roleListBox, "selectedIndex", logicalRoleCheckbox, "disabled", buttonConverter);
        }
    } catch (XulException xe) {
    } catch (KettleException xe) {
    }
}
Also used : XulCheckbox(org.pentaho.ui.xul.components.XulCheckbox) KettleException(org.pentaho.di.core.exception.KettleException) IAbsSecurityManager(org.pentaho.di.ui.repository.pur.services.IAbsSecurityManager) XulException(org.pentaho.ui.xul.XulException)

Example 4 with IAbsSecurityManager

use of org.pentaho.di.ui.repository.pur.services.IAbsSecurityManager in project pentaho-kettle by pentaho.

the class AbsController method applyRoleActionPermission.

/**
 * Save the permission for the selected role
 */
public void applyRoleActionPermission() {
    XulMessageBox messageBox = this.getMessageBox();
    IUIRole role = null;
    IUIAbsRole absRole = null;
    try {
        role = absSecurity.getSelectedRole();
        if (role instanceof IUIAbsRole) {
            absRole = (IUIAbsRole) role;
        } else {
            throw new IllegalStateException();
        }
        ((IAbsSecurityManager) service).setLogicalRoles(absRole.getName(), absRole.getLogicalRoles());
        // $NON-NLS-1$
        messageBox.setTitle(BaseMessages.getString(PKG, "Dialog.Success"));
        // $NON-NLS-1$
        messageBox.setAcceptLabel(BaseMessages.getString(PKG, "Dialog.Ok"));
        // $NON-NLS-1$
        messageBox.setMessage(BaseMessages.getString(PKG, "AbsController.RoleActionPermission.Success"));
        messageBox.open();
        // Refresh permissions in open tabs
        SpoonPluginManager.getInstance().notifyLifecycleListeners(SpoonLifecycleListener.SpoonLifeCycleEvent.REPOSITORY_CHANGED);
    } catch (KettleException e) {
        // $NON-NLS-1$
        messageBox.setTitle(BaseMessages.getString(PKG, "Dialog.Error"));
        // $NON-NLS-1$
        messageBox.setAcceptLabel(BaseMessages.getString(PKG, "Dialog.Ok"));
        messageBox.setMessage(BaseMessages.getString(PKG, "AbsController.RoleActionPermission.UnableToApplyPermissions", role.getName(), // $NON-NLS-1$
        e.getLocalizedMessage()));
        messageBox.open();
    }
}
Also used : IUIAbsRole(org.pentaho.di.ui.repository.pur.repositoryexplorer.abs.IUIAbsRole) KettleException(org.pentaho.di.core.exception.KettleException) XulMessageBox(org.pentaho.ui.xul.components.XulMessageBox) IAbsSecurityManager(org.pentaho.di.ui.repository.pur.services.IAbsSecurityManager) IUIRole(org.pentaho.di.ui.repository.pur.repositoryexplorer.IUIRole)

Aggregations

KettleException (org.pentaho.di.core.exception.KettleException)4 IAbsSecurityManager (org.pentaho.di.ui.repository.pur.services.IAbsSecurityManager)4 IUIRole (org.pentaho.di.ui.repository.pur.repositoryexplorer.IUIRole)2 IUIAbsRole (org.pentaho.di.ui.repository.pur.repositoryexplorer.abs.IUIAbsRole)2 XulException (org.pentaho.ui.xul.XulException)2 XulCheckbox (org.pentaho.ui.xul.components.XulCheckbox)2 XulMessageBox (org.pentaho.ui.xul.components.XulMessageBox)2