use of org.pentaho.di.ui.repository.pur.repositoryexplorer.abs.controller.SpoonMenuABSController in project pentaho-kettle by pentaho.
the class EESpoonPlugin method applyToContainer.
public void applyToContainer(String category, XulDomContainer container) throws XulException {
container.registerClassLoader(getClass().getClassLoader());
if (category.equals("spoon")) {
// $NON-NLS-1$
// register the two controllers, note that the lock controller must come
// after the abs controller so the biz logic between the two hold.
// Register the ABS Menu controller
getSpoonInstance().addSpoonMenuController(new SpoonMenuABSController());
// Register the SpoonMenuLockController to modify the main Spoon Menu structure
getSpoonInstance().addSpoonMenuController(new SpoonMenuLockController());
} else if (category.equals("trans-graph") || category.equals("job-graph")) {
// $NON-NLS-1$ //$NON-NLS-2$
if ((getSpoonInstance() != null) && (getSpoonInstance().getRepository() != null) && (getSpoonInstance().getRepository() instanceof PurRepository)) {
// $NON-NLS-1$
container.getDocumentRoot().addOverlay("org/pentaho/di/ui/repository/pur/xul/spoon-lock-overlay.xul");
container.addEventHandler(new SpoonLockController());
}
try {
Repository repository = getSpoonInstance().getRepository();
if (repository != null) {
IAbsSecurityProvider securityProvider = (IAbsSecurityProvider) repository.getService(IAbsSecurityProvider.class);
if (securityProvider != null) {
enablePermission(securityProvider);
}
}
} catch (KettleException e) {
e.printStackTrace();
}
} else if (category.equals("repository-explorer")) {
// $NON-NLS-1$
try {
Repository repository = getSpoonInstance().getRepository();
IAbsSecurityProvider securityProvider = null;
if (repository != null) {
securityProvider = (IAbsSecurityProvider) repository.getService(IAbsSecurityProvider.class);
}
if (securityProvider != null) {
boolean createPermitted = securityProvider.isAllowed(IAbsSecurityProvider.CREATE_CONTENT_ACTION);
boolean executePermitted = securityProvider.isAllowed(IAbsSecurityProvider.EXECUTE_CONTENT_ACTION);
// Disable export if user can not create or execute content (prevents execution outside of this repo)
container.getDocumentRoot().getElementById("folder-context-export").setDisabled(!createPermitted || !executePermitted);
}
} catch (KettleException e) {
e.printStackTrace();
}
}
}
Aggregations