Search in sources :

Example 1 with IUIAbsRole

use of org.pentaho.di.ui.repository.pur.repositoryexplorer.abs.IUIAbsRole in project pentaho-kettle by pentaho.

the class AbsController method setSelectedSystemRoleChanged.

/**
 * The method is called when a user select a role from the role list. This method reads the current selected role and
 * populates the Action Permission UI with the details
 */
public void setSelectedSystemRoleChanged(IUIRole role) throws Exception {
    IUIAbsRole absRole = null;
    uncheckAllSystemActionPermissions();
    if (role instanceof IUIAbsRole) {
        absRole = (IUIAbsRole) role;
        if (absRole != null && absRole.getLogicalRoles() != null) {
            for (String permission : absRole.getLogicalRoles()) {
                XulCheckbox permissionCheckbox = findSystemRoleCheckbox(permission);
                if (permissionCheckbox != null) {
                    permissionCheckbox.setChecked(true);
                }
            }
        }
    } else {
        throw new IllegalStateException();
    }
}
Also used : IUIAbsRole(org.pentaho.di.ui.repository.pur.repositoryexplorer.abs.IUIAbsRole) XulCheckbox(org.pentaho.ui.xul.components.XulCheckbox)

Example 2 with IUIAbsRole

use of org.pentaho.di.ui.repository.pur.repositoryexplorer.abs.IUIAbsRole 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 3 with IUIAbsRole

use of org.pentaho.di.ui.repository.pur.repositoryexplorer.abs.IUIAbsRole 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)

Example 4 with IUIAbsRole

use of org.pentaho.di.ui.repository.pur.repositoryexplorer.abs.IUIAbsRole in project pentaho-kettle by pentaho.

the class AbsController method setSelectedRoleChanged.

/**
 * The method is called when a user select a role from the role list. This method reads the current selected role and
 * populates the Action Permission UI with the details
 */
public void setSelectedRoleChanged(IUIRole role) throws Exception {
    IUIAbsRole absRole = null;
    uncheckAllActionPermissions();
    if (role instanceof IUIAbsRole) {
        absRole = (IUIAbsRole) role;
        if (absRole != null && absRole.getLogicalRoles() != null) {
            for (String permission : absRole.getLogicalRoles()) {
                XulCheckbox permissionCheckbox = findRoleCheckbox(permission);
                if (permissionCheckbox != null) {
                    permissionCheckbox.setChecked(true);
                }
            }
        }
    } else {
        throw new IllegalStateException();
    }
}
Also used : IUIAbsRole(org.pentaho.di.ui.repository.pur.repositoryexplorer.abs.IUIAbsRole) XulCheckbox(org.pentaho.ui.xul.components.XulCheckbox)

Aggregations

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