Search in sources :

Example 1 with UIRepositoryObjectAcl

use of org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIRepositoryObjectAcl in project pentaho-kettle by pentaho.

the class PermissionsController method createBindings.

protected void createBindings() {
    super.createBindings();
    // $NON-NLS-1$
    fileFolderLabel = (XulLabel) document.getElementById("file-folder-name");
    // $NON-NLS-1$
    aclDeck = (XulDeck) document.getElementById("acl-deck");
    // $NON-NLS-1$
    inheritParentPermissionCheckbox = (XulCheckbox) document.getElementById("inherit-from-parent-permission-checkbox");
    bf.setBindingType(Binding.Type.ONE_WAY);
    BindingConvertor<List<UIRepositoryObject>, List<UIRepositoryObjectAcl>> securityBindingConverter = new BindingConvertor<List<UIRepositoryObject>, List<UIRepositoryObjectAcl>>() {

        @Override
        public List<UIRepositoryObjectAcl> sourceToTarget(List<UIRepositoryObject> ro) {
            if (ro == null) {
                return null;
            }
            if (ro.size() <= 0) {
                return null;
            }
            setSelectedRepositoryObject(ro);
            if (!hasManageAclAccess()) {
                // disable everything
                applyAclButton.setDisabled(true);
                addAclButton.setDisabled(true);
                removeAclButton.setDisabled(true);
                inheritParentPermissionCheckbox.setDisabled(true);
                manageAclCheckbox.setDisabled(true);
                deleteCheckbox.setDisabled(true);
                writeCheckbox.setDisabled(true);
                readCheckbox.setDisabled(true);
                viewAclsModel.setHasManageAclAccess(false);
            } else {
                applyAclButton.setDisabled(false);
                inheritParentPermissionCheckbox.setDisabled(false);
                viewAclsModel.setHasManageAclAccess(true);
            }
            viewAclsModel.setRemoveEnabled(false);
            List<UIRepositoryObjectAcl> selectedAclList = Collections.emptyList();
            // we've moved to a new file/folder; need to clear out what the model thinks is selected
            viewAclsModel.setSelectedAclList(selectedAclList);
            permissionsCheckboxHandler.updateCheckboxes(EnumSet.noneOf(RepositoryFilePermission.class));
            UIRepositoryObject repoObject = ro.get(0);
            try {
                if (repoObject instanceof IAclObject) {
                    ((IAclObject) repoObject).getAcls(viewAclsModel);
                } else {
                    // $NON-NLS-1$
                    throw new IllegalStateException(BaseMessages.getString(PKG, "PermissionsController.NoAclSupport"));
                }
                fileFolderLabel.setValue(// $NON-NLS-1$
                BaseMessages.getString(PKG, "AclTab.UserRolePermission", repoObject.getName()));
                bf.setBindingType(Binding.Type.ONE_WAY);
                // $NON-NLS-1$ //$NON-NLS-2$
                bf.createBinding(viewAclsModel, "acls", userRoleList, "elements");
                updateInheritFromParentPermission();
            } catch (AccessDeniedException ade) {
                if (mainController == null || !mainController.handleLostRepository(ade)) {
                    // $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, "PermissionsController.UnableToGetAcls", repoObject.getName(), // $NON-NLS-1$
                    ade.getLocalizedMessage()));
                    messageBox.open();
                }
            } catch (Exception e) {
                if (mainController == null || !mainController.handleLostRepository(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, "PermissionsController.UnableToGetAcls", repoObject.getName(), // $NON-NLS-1$
                    e.getLocalizedMessage()));
                    messageBox.open();
                }
            }
            aclDeck.setSelectedIndex(ACL);
            return viewAclsModel.getAcls();
        }

        @Override
        public List<UIRepositoryObject> targetToSource(List<UIRepositoryObjectAcl> elements) {
            return null;
        }
    };
    // Binding between the selected repository objects and the user role list for acls
    securityBinding = // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(browseController, "repositoryObjects", userRoleList, "elements", securityBindingConverter);
    securityBinding = // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(browseController, "repositoryDirectories", userRoleList, "elements", securityBindingConverter);
    bf.setBindingType(Binding.Type.BI_DIRECTIONAL);
    // Binding Add Remove button to the inherit check box. If the checkbox is checked that disable add remove
    // $NON-NLS-1$  //$NON-NLS-2$
    bf.createBinding(viewAclsModel, "entriesInheriting", inheritParentPermissionCheckbox, "checked");
    // Setting the default Deck to show no permission
    aclDeck.setSelectedIndex(NO_ACL);
    try {
        if (securityBinding != null) {
            securityBinding.fireSourceChanged();
        }
    } catch (Exception e) {
        if (mainController == null || !mainController.handleLostRepository(e)) {
            // convert to runtime exception so it bubbles up through the UI
            throw new RuntimeException(e);
        }
    }
}
Also used : UIRepositoryObject(org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObject) AccessDeniedException(org.pentaho.di.ui.repository.repositoryexplorer.AccessDeniedException) UIRepositoryObjectAcl(org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIRepositoryObjectAcl) RepositoryFilePermission(org.pentaho.platform.api.repository2.unified.RepositoryFilePermission) ArrayList(java.util.ArrayList) List(java.util.List) IAclObject(org.pentaho.di.ui.repository.pur.repositoryexplorer.IAclObject) BindingConvertor(org.pentaho.ui.xul.binding.BindingConvertor) KettleException(org.pentaho.di.core.exception.KettleException) AccessDeniedException(org.pentaho.di.ui.repository.repositoryexplorer.AccessDeniedException) ControllerInitializationException(org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException)

Example 2 with UIRepositoryObjectAcl

use of org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIRepositoryObjectAcl in project pentaho-kettle by pentaho.

the class AbstractPermissionsController method createBindings.

protected void createBindings() {
    // $NON-NLS-1$
    userRoleList = (XulListbox) document.getElementById(getXulPrefix() + "user-role-list");
    // $NON-NLS-1$
    writeCheckbox = (XulCheckbox) document.getElementById(getXulPrefix() + "write-checkbox");
    // $NON-NLS-1$
    readCheckbox = (XulCheckbox) document.getElementById(getXulPrefix() + "read-checkbox");
    // $NON-NLS-1$
    manageAclCheckbox = (XulCheckbox) document.getElementById(getXulPrefix() + "manage-checkbox");
    // $NON-NLS-1$
    deleteCheckbox = (XulCheckbox) document.getElementById(getXulPrefix() + "delete-checkbox");
    // $NON-NLS-1$
    addAclButton = (XulButton) document.getElementById(getXulPrefix() + "add-acl-button");
    // $NON-NLS-1$
    removeAclButton = (XulButton) document.getElementById(getXulPrefix() + "remove-acl-button");
    // $NON-NLS-1$
    manageAclsDialog = (XulDialog) document.getElementById(getXulPrefix() + "manage-acls-dialog");
    permissionsCheckboxHandler = new PermissionsCheckboxHandler(readCheckbox, writeCheckbox, deleteCheckbox, manageAclCheckbox);
    // Add/Remove Acl Binding
    // $NON-NLS-1$
    availableUserList = (XulListbox) document.getElementById(getXulPrefix() + "available-user-list");
    // $NON-NLS-1$
    selectedUserList = (XulListbox) document.getElementById(getXulPrefix() + "selected-user-list");
    // $NON-NLS-1$
    availableRoleList = (XulListbox) document.getElementById(getXulPrefix() + "available-role-list");
    // $NON-NLS-1$
    selectedRoleList = (XulListbox) document.getElementById(getXulPrefix() + "selected-role-list");
    // $NON-NLS-1$
    assignRoleButton = (XulButton) document.getElementById(getXulPrefix() + "assign-role");
    // $NON-NLS-1$
    unassignRoleButton = (XulButton) document.getElementById(getXulPrefix() + "unassign-role");
    // $NON-NLS-1$
    assignUserButton = (XulButton) document.getElementById(getXulPrefix() + "assign-user");
    // $NON-NLS-1$
    unassignUserButton = (XulButton) document.getElementById(getXulPrefix() + "unassign-user");
    // $NON-NLS-1$
    applyAclButton = (XulButton) document.getElementById(getXulPrefix() + "apply-acl");
    // Binding the model user or role list to the ui user or role list
    bf.setBindingType(Binding.Type.ONE_WAY);
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(manageAclsModel, "availableUserList", availableUserList, "elements");
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(manageAclsModel, "selectedUserList", selectedUserList, "elements");
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(manageAclsModel, "availableRoleList", availableRoleList, "elements");
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(manageAclsModel, "selectedRoleList", selectedRoleList, "elements");
    // indicesToObjectsConverter convert the selected indices to the list of objects and vice versa
    BindingConvertor<int[], List<UIRepositoryObjectAcl>> indicesToObjectsConverter = new BindingConvertor<int[], List<UIRepositoryObjectAcl>>() {

        @Override
        public int[] targetToSource(List<UIRepositoryObjectAcl> acls) {
            if (acls != null) {
                int i = 0;
                int[] retVal = new int[acls.size()];
                for (UIRepositoryObjectAcl acl : acls) {
                    retVal[i++] = viewAclsModel.getAceIndex(acl.getAce());
                }
                return retVal;
            }
            return null;
        }

        @Override
        public List<UIRepositoryObjectAcl> sourceToTarget(int[] indices) {
            if (indices != null && indices.length > 0) {
                List<UIRepositoryObjectAcl> retVal = new ArrayList<UIRepositoryObjectAcl>();
                for (int i = 0; i < indices.length; i++) {
                    retVal.add(new UIRepositoryObjectAcl(viewAclsModel.getAceAtIndex(indices[i])));
                }
                return retVal;
            }
            return null;
        }
    };
    // indexToAvalableUserConverter convert the selected indices to the list of objects and vice versa
    BindingConvertor<int[], List<String>> indexToAvailableUserConverter = new BindingConvertor<int[], List<String>>() {

        @Override
        public List<String> sourceToTarget(int[] indices) {
            List<String> userList = new ArrayList<String>();
            for (int i = 0; i < indices.length; i++) {
                userList.add(manageAclsModel.getAvailableUser(indices[i]));
            }
            return userList;
        }

        @Override
        public int[] targetToSource(List<String> userList) {
            int[] indices = new int[userList.size()];
            int i = 0;
            for (String user : userList) {
                indices[i++] = manageAclsModel.getAvailableUserIndex(user);
            }
            return indices;
        }
    };
    BindingConvertor<int[], List<String>> indexToAvailableRoleConverter = new BindingConvertor<int[], List<String>>() {

        @Override
        public List<String> sourceToTarget(int[] indices) {
            List<String> roleList = new ArrayList<String>();
            for (int i = 0; i < indices.length; i++) {
                roleList.add(manageAclsModel.getAvailableRole(indices[i]));
            }
            return roleList;
        }

        @Override
        public int[] targetToSource(List<String> roleList) {
            int[] indices = new int[roleList.size()];
            int i = 0;
            for (String role : roleList) {
                indices[i++] = manageAclsModel.getAvailableRoleIndex(role);
            }
            return indices;
        }
    };
    BindingConvertor<int[], List<UIRepositoryObjectAcl>> indexToSelectedUserConverter = new BindingConvertor<int[], List<UIRepositoryObjectAcl>>() {

        @Override
        public List<UIRepositoryObjectAcl> sourceToTarget(int[] indices) {
            List<UIRepositoryObjectAcl> userList = new ArrayList<UIRepositoryObjectAcl>();
            for (int i = 0; i < indices.length; i++) {
                userList.add(manageAclsModel.getSelectedUser(indices[i]));
            }
            return userList;
        }

        @Override
        public int[] targetToSource(List<UIRepositoryObjectAcl> userList) {
            int[] indices = new int[userList.size()];
            int i = 0;
            for (UIRepositoryObjectAcl user : userList) {
                indices[i++] = manageAclsModel.getSelectedUserIndex(user);
            }
            return indices;
        }
    };
    BindingConvertor<int[], List<UIRepositoryObjectAcl>> indexToSelectedRoleConverter = new BindingConvertor<int[], List<UIRepositoryObjectAcl>>() {

        @Override
        public List<UIRepositoryObjectAcl> sourceToTarget(int[] indices) {
            List<UIRepositoryObjectAcl> roleList = new ArrayList<UIRepositoryObjectAcl>();
            for (int i = 0; i < indices.length; i++) {
                roleList.add(manageAclsModel.getSelectedRole(indices[i]));
            }
            return roleList;
        }

        @Override
        public int[] targetToSource(List<UIRepositoryObjectAcl> roleList) {
            int[] indices = new int[roleList.size()];
            int i = 0;
            for (UIRepositoryObjectAcl role : roleList) {
                indices[i++] = manageAclsModel.getSelectedRoleIndex(role);
            }
            return indices;
        }
    };
    // Binding between the selected incides of the lists to the mode list objects
    bf.setBindingType(Binding.Type.BI_DIRECTIONAL);
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(// $NON-NLS-1$ //$NON-NLS-2$
    availableUserList, // $NON-NLS-1$ //$NON-NLS-2$
    "selectedIndices", // $NON-NLS-1$ //$NON-NLS-2$
    manageAclsModel, // $NON-NLS-1$ //$NON-NLS-2$
    "selectedAvailableUsers", indexToAvailableUserConverter);
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(// $NON-NLS-1$ //$NON-NLS-2$
    selectedUserList, // $NON-NLS-1$ //$NON-NLS-2$
    "selectedIndices", // $NON-NLS-1$ //$NON-NLS-2$
    manageAclsModel, // $NON-NLS-1$ //$NON-NLS-2$
    "selectedAssignedUsers", indexToSelectedUserConverter);
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(// $NON-NLS-1$ //$NON-NLS-2$
    availableRoleList, // $NON-NLS-1$ //$NON-NLS-2$
    "selectedIndices", // $NON-NLS-1$ //$NON-NLS-2$
    manageAclsModel, // $NON-NLS-1$ //$NON-NLS-2$
    "selectedAvailableRoles", indexToAvailableRoleConverter);
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(// $NON-NLS-1$ //$NON-NLS-2$
    selectedRoleList, // $NON-NLS-1$ //$NON-NLS-2$
    "selectedIndices", // $NON-NLS-1$ //$NON-NLS-2$
    manageAclsModel, // $NON-NLS-1$ //$NON-NLS-2$
    "selectedAssignedRoles", indexToSelectedRoleConverter);
    // Binding the selected indices of acl list to the list of acl objects in the mode
    // $NON-NLS-1$  //$NON-NLS-2$
    bf.createBinding(userRoleList, "selectedIndices", viewAclsModel, "selectedAclList", indicesToObjectsConverter);
    // accumulatorButtonConverter determine whether to enable of disable the accumulator buttons
    BindingConvertor<Integer, Boolean> accumulatorButtonConverter = new BindingConvertor<Integer, Boolean>() {

        @Override
        public Boolean sourceToTarget(Integer value) {
            if (value != null && value >= 0) {
                return true;
            }
            return false;
        }

        @Override
        public Integer targetToSource(Boolean value) {
            // One way binding, nothing to do here
            return null;
        }
    };
    bf.setBindingType(Binding.Type.ONE_WAY);
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(// $NON-NLS-1$ //$NON-NLS-2$
    selectedUserList, // $NON-NLS-1$ //$NON-NLS-2$
    "selectedIndex", // $NON-NLS-1$ //$NON-NLS-2$
    manageAclsModel, // $NON-NLS-1$ //$NON-NLS-2$
    "userUnassignmentPossible", accumulatorButtonConverter);
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(// $NON-NLS-1$ //$NON-NLS-2$
    availableUserList, // $NON-NLS-1$ //$NON-NLS-2$
    "selectedIndex", // $NON-NLS-1$ //$NON-NLS-2$
    manageAclsModel, // $NON-NLS-1$ //$NON-NLS-2$
    "userAssignmentPossible", accumulatorButtonConverter);
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(manageAclsModel, "userUnassignmentPossible", unassignUserButton, "!disabled");
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(manageAclsModel, "userAssignmentPossible", assignUserButton, "!disabled");
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(// $NON-NLS-1$ //$NON-NLS-2$
    selectedRoleList, // $NON-NLS-1$ //$NON-NLS-2$
    "selectedIndex", // $NON-NLS-1$ //$NON-NLS-2$
    manageAclsModel, // $NON-NLS-1$ //$NON-NLS-2$
    "roleUnassignmentPossible", accumulatorButtonConverter);
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(// $NON-NLS-1$ //$NON-NLS-2$
    availableRoleList, // $NON-NLS-1$ //$NON-NLS-2$
    "selectedIndex", // $NON-NLS-1$ //$NON-NLS-2$
    manageAclsModel, // $NON-NLS-1$ //$NON-NLS-2$
    "roleAssignmentPossible", accumulatorButtonConverter);
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(manageAclsModel, "roleUnassignmentPossible", unassignRoleButton, "!disabled");
    // $NON-NLS-1$ //$NON-NLS-2$
    bf.createBinding(manageAclsModel, "roleAssignmentPossible", assignRoleButton, "!disabled");
    // Only enable remove Acl button if the entries checkbox is unchecked and acl is selected from the list
    // $NON-NLS-1$  //$NON-NLS-2$
    bf.createBinding(viewAclsModel, "removeEnabled", removeAclButton, "!disabled");
    // Binding when the user select from the list
    // $NON-NLS-1$  //$NON-NLS-2$
    bf.createBinding(// $NON-NLS-1$  //$NON-NLS-2$
    viewAclsModel, // $NON-NLS-1$  //$NON-NLS-2$
    "selectedAclList", // $NON-NLS-1$  //$NON-NLS-2$
    this, // $NON-NLS-1$  //$NON-NLS-2$
    "aclState", new BindingConvertor<List<UIRepositoryObjectAcl>, UIRepositoryObjectAcl>() {

        @Override
        public UIRepositoryObjectAcl sourceToTarget(List<UIRepositoryObjectAcl> value) {
            if (value != null && value.size() > 0) {
                return value.get(0);
            }
            return null;
        }

        @Override
        public List<UIRepositoryObjectAcl> targetToSource(UIRepositoryObjectAcl value) {
            return null;
        }
    });
    // $NON-NLS-1$  //$NON-NLS-2$
    bf.createBinding(userRoleList, "selectedItem", this, "recipientChanged");
}
Also used : UIRepositoryObjectAcl(org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIRepositoryObjectAcl) ArrayList(java.util.ArrayList) BindingConvertor(org.pentaho.ui.xul.binding.BindingConvertor) ArrayList(java.util.ArrayList) List(java.util.List)

Example 3 with UIRepositoryObjectAcl

use of org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIRepositoryObjectAcl in project pentaho-kettle by pentaho.

the class AbstractPermissionsController method updatePermission.

/*
   * updatePermission method is called when the user checks or uncheck any permission checkbox. This method updates the
   * current model with the update value from the UI
   */
public void updatePermission() {
    UIRepositoryObjectAcl acl = (UIRepositoryObjectAcl) userRoleList.getSelectedItem();
    if (acl == null) {
        throw new IllegalStateException(BaseMessages.getString(PKG, "PermissionsController.NoSelectedRecipient"));
    }
    acl.setPermissionSet(permissionsCheckboxHandler.processCheckboxes());
    clearSelectedObjAcl();
    viewAclsModel.updateAcl(acl);
}
Also used : UIRepositoryObjectAcl(org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIRepositoryObjectAcl)

Example 4 with UIRepositoryObjectAcl

use of org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIRepositoryObjectAcl in project pentaho-kettle by pentaho.

the class ConnectionPermissionsController method createBindings.

protected void createBindings() {
    super.createBindings();
    // $NON-NLS-1$
    connNameLabel = (XulLabel) document.getElementById("conn-name");
    bf.setBindingType(Binding.Type.ONE_WAY);
    BindingConvertor<List<UIDatabaseConnection>, List<UIRepositoryObjectAcl>> securityBindingConverter = new BindingConvertor<List<UIDatabaseConnection>, List<UIRepositoryObjectAcl>>() {

        @Override
        public List<UIRepositoryObjectAcl> sourceToTarget(List<UIDatabaseConnection> ro) {
            if (ro == null) {
                return null;
            }
            if (ro.size() <= 0) {
                return null;
            }
            setSelectedDatabaseConnections(ro);
            if (!hasManageAclAccess()) {
                applyAclButton.setDisabled(true);
                addAclButton.setDisabled(true);
                removeAclButton.setDisabled(true);
                manageAclCheckbox.setDisabled(true);
                deleteCheckbox.setDisabled(true);
                writeCheckbox.setDisabled(true);
                readCheckbox.setDisabled(true);
                viewAclsModel.setHasManageAclAccess(false);
            } else {
                applyAclButton.setDisabled(false);
                addAclButton.setDisabled(false);
                viewAclsModel.setHasManageAclAccess(true);
            }
            viewAclsModel.setRemoveEnabled(false);
            List<UIRepositoryObjectAcl> selectedAclList = Collections.emptyList();
            // we've moved to a connection; need to clear out what the model thinks is selected
            viewAclsModel.setSelectedAclList(selectedAclList);
            permissionsCheckboxHandler.setAllChecked(false);
            UIDatabaseConnection dbconnObject = ro.get(0);
            try {
                if (dbconnObject instanceof IAclObject) {
                    IAclObject aclObj = (IAclObject) dbconnObject;
                    // This is a special case for DB Connections, wipe out the isEnherting flag.
                    // This will cause the model to become "dirty", and prompt the user for changes the first time
                    // let's make sure the default creation behavior of connections is to be that inheritance is
                    // set to false, so this case never presents itself in the wild.
                    aclObj.getAcls(viewAclsModel);
                    if (viewAclsModel.isEntriesInheriting()) {
                        viewAclsModel.setEntriesInheriting(false);
                        aclObj.setAcls(viewAclsModel);
                        viewAclsModel.setModelDirty(false);
                    }
                } else {
                    // $NON-NLS-1$
                    throw new IllegalStateException(BaseMessages.getString(PKG, "PermissionsController.NoAclSupport"));
                }
                connNameLabel.setValue(BaseMessages.getString(PKG, "AclTab.ConnectionPermission", // $NON-NLS-1$
                dbconnObject.getDisplayName()));
                bf.setBindingType(Binding.Type.ONE_WAY);
                // $NON-NLS-1$ //$NON-NLS-2$
                bf.createBinding(viewAclsModel, "acls", userRoleList, "elements");
            } catch (AccessDeniedException ade) {
                // $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, "PermissionsController.UnableToGetAcls", dbconnObject.getName(), // $NON-NLS-1$
                ade.getLocalizedMessage()));
                messageBox.open();
            } catch (Exception e) {
                if (mainController == null || !mainController.handleLostRepository(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, "PermissionsController.UnableToGetAcls", dbconnObject.getName(), // $NON-NLS-1$
                    e.getLocalizedMessage()));
                    messageBox.open();
                }
            }
            return viewAclsModel.getAcls();
        }

        @Override
        public List<UIDatabaseConnection> targetToSource(List<UIRepositoryObjectAcl> elements) {
            // One way binding, nothing to do here
            return null;
        }
    };
    // Binding between the selected repository objects and the user role list for acls
    securityBinding = bf.createBinding(connectionsController, "repositoryConnections", userRoleList, "elements", // $NON-NLS-1$ //$NON-NLS-2$
    securityBindingConverter);
    try {
        if (securityBinding != null) {
            securityBinding.fireSourceChanged();
        }
    } catch (Exception e) {
        if (mainController == null || !mainController.handleLostRepository(e)) {
            // convert to runtime exception so it bubbles up through the UI
            throw new RuntimeException(e);
        }
    }
}
Also used : AccessDeniedException(org.pentaho.di.ui.repository.repositoryexplorer.AccessDeniedException) UIDatabaseConnection(org.pentaho.di.ui.repository.repositoryexplorer.model.UIDatabaseConnection) UIRepositoryObjectAcl(org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIRepositoryObjectAcl) ArrayList(java.util.ArrayList) List(java.util.List) IAclObject(org.pentaho.di.ui.repository.pur.repositoryexplorer.IAclObject) BindingConvertor(org.pentaho.ui.xul.binding.BindingConvertor) AccessDeniedException(org.pentaho.di.ui.repository.repositoryexplorer.AccessDeniedException) ControllerInitializationException(org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException)

Aggregations

UIRepositoryObjectAcl (org.pentaho.di.ui.repository.pur.repositoryexplorer.model.UIRepositoryObjectAcl)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 BindingConvertor (org.pentaho.ui.xul.binding.BindingConvertor)3 IAclObject (org.pentaho.di.ui.repository.pur.repositoryexplorer.IAclObject)2 AccessDeniedException (org.pentaho.di.ui.repository.repositoryexplorer.AccessDeniedException)2 ControllerInitializationException (org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException)2 KettleException (org.pentaho.di.core.exception.KettleException)1 UIDatabaseConnection (org.pentaho.di.ui.repository.repositoryexplorer.model.UIDatabaseConnection)1 UIRepositoryObject (org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryObject)1 RepositoryFilePermission (org.pentaho.platform.api.repository2.unified.RepositoryFilePermission)1