eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/OpenFeatureTreeEditorWizardHandler.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/SelectFeatureTreeWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/SelectFeatureTreeWizardPage.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/OpenPasswordWizzardHandler.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/ShowLoginWindowHandler.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/identificationkey/AbstractIdentificaitonKeyWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/AbstractIOManager.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/TaxonRelationshipTypeMenuPreferences.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/VocabularyTermWizard.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/wizard/VocabularyTermWizardPage.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/security/AuthenticationSourceProvider.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/security/PermissionPropertyTester.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/security/RequiredPermissions.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/security/RolesSourceProvider.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStoreConnector.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/ContextManager.java -text
label="Switch User"
style="push">
</command>
+ <command
+ commandId="eu.etaxonomy.taxeditor.store.openPasswordWizzard"
+ label="Change Password"
+ style="push">
+ </command>
<separator
name="eu.etaxonomy.taxeditor.application.filemenu.login"
visible="true">
</reference>
</activeWhen>
</handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.handler.ShowLoginWindowHandler"
+ commandId="eu.etaxonomy.taxeditor.store.operations.showLoginWindow">
+ <enabledWhen>
+ <reference
+ definitionId="isUserLoggedIn">
+ </reference></enabledWhen>
+ </handler>
+ <handler
+ class="eu.etaxonomy.taxeditor.handler.OpenPasswordWizzardHandler"
+ commandId="eu.etaxonomy.taxeditor.store.openPasswordWizzard">
+ <enabledWhen>
+ <reference
+ definitionId="isUserLoggedIn">
+ </reference></enabledWhen>
+ </handler>
</extension>
<extension
name="Popup Menu Commands"
name="Update Datasource">
</command>
<command
- defaultHandler="eu.etaxonomy.taxeditor.handler.ShowLoginWindowHandler"
id="eu.etaxonomy.taxeditor.store.operations.showLoginWindow"
name="Show Login Window">
</command>
id="eu.etaxonomy.taxeditor.store.open.FeatureTreeEditorWizard"
name="Open Feature Tree Editor Wizard">
</command>
+ <command
+ id="eu.etaxonomy.taxeditor.store.openPasswordWizzard"
+ name="Open Password Wizzard">
+ </command>
</extension>
<extension
point="org.eclipse.ui.importWizards">
</test>
</with>
</definition>
+ <definition
+ id="isUserLoggedIn">
+ <with
+ variable="eu.etaxonomy.taxeditor.security.user">
+ <instanceof
+ value="eu.etaxonomy.cdm.model.common.User">
+ </instanceof>
+ </with>
+ </definition>
<definition
id="hasROLE_USER_MANAGER">
<with
<extension
point="org.eclipse.ui.services">
<sourceProvider
- provider="eu.etaxonomy.taxeditor.security.RolesSourceProvider">
+ provider="eu.etaxonomy.taxeditor.security.AuthenticationSourceProvider">
<variable
name="eu.etaxonomy.taxeditor.security.userRoles"
priorityLevel="workbench">
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.jface.wizard.WizardDialog;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.model.common.User;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.password.PasswordWizard;
+
+/**
+ * <p>ShowLoginWindowHandler class.</p>
+ *
+ * @author n.hoffmann
+ * @created Aug 7, 2009
+ * @version 1.0
+ */
+public class OpenPasswordWizzardHandler extends AbstractHandler implements IHandler{
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ Object principal = CdmStore.getCurrentAuthentiation().getPrincipal();
+
+ if(principal instanceof User){
+ ConversationHolder conversation = CdmStore.createConversation();
+
+ PasswordWizard wizard = new PasswordWizard(conversation, (User)principal);
+ WizardDialog dialog = new WizardDialog(AbstractUtility.getShell(), wizard);
+
+ dialog.open();
+
+ // clean up
+ conversation.commit();
+ conversation.unbind();
+ conversation.close();
+ } else {
+ // should never happen, log an error
+ AbstractUtility.error(OpenPasswordWizzardHandler.class, "The principal currently authenticated is not a eu.etaxonomy.cdm.model.common.User", null);
+ }
+
+ return null;
+
+ }
+
+
+
+}
/**
* Provides the Roles assigned to the currently authenticated principal as the
* variable {@code eu.etaxonomy.taxeditor.security.userRoles}
- *
+ *
* @author a.kohlbecker
- *
+ *
*/
-public class RolesSourceProvider extends AbstractSourceProvider implements Observer {
+public class AuthenticationSourceProvider extends AbstractSourceProvider implements Observer {
- public final static String RIGHTS_VARIABLE = "eu.etaxonomy.taxeditor.security.userRoles";
- private final static String[] PROVIDED_SOURCE_NAMES = new String[] { RIGHTS_VARIABLE };
+ public final static String USER_ROLES_VARIABLE = "eu.etaxonomy.taxeditor.security.userRoles";
+ public final static String USER_NAME_VARIABLE = "eu.etaxonomy.taxeditor.security.userName";
+ public final static String USER_VARIABLE = "eu.etaxonomy.taxeditor.security.user";
- private final static Map<String, List<String>> stateMap = new HashMap<String, List<String>>();
+ private final static String[] PROVIDED_SOURCE_NAMES = new String[] {
+ USER_ROLES_VARIABLE,
+ USER_NAME_VARIABLE,
+ USER_VARIABLE
+ };
- public RolesSourceProvider() {
+ private final static Map<String, Object> stateMap = new HashMap<String, Object>();
+
+ public AuthenticationSourceProvider() {
super();
initialize();
}
rolesStr.add(r.getAuthority());
}
- stateMap.put(RIGHTS_VARIABLE, rolesStr);
+ stateMap.put(USER_ROLES_VARIABLE, rolesStr);
+ stateMap.put(USER_VARIABLE, getCurrentAutheticationPrincipal());
+ stateMap.put(USER_NAME_VARIABLE, getCurrentAutheticationName());
return stateMap;
}
- /*
+ /**
+ * @return
+ */
+ private String getCurrentAutheticationName() {
+ Authentication authentication = CdmStore.getCurrentAuthentiation();
+ if (authentication != null) {
+ return authentication.getName();
+ }
+ return null;
+ }
+
+ /**
+ * @return most probably a Cdm User instance or null
+ */
+ private Object getCurrentAutheticationPrincipal() {
+ Authentication authentication = CdmStore.getCurrentAuthentiation();
+ if (authentication != null) {
+ return authentication.getPrincipal();
+ }
+ return null;
+ }
+
+
+ /*
* TODO refactor into User once Role is a model class
*/
private List<Role> getCurrentAuthenticationsRoles() {
}
- public String[] getProvidedSourceNames() {
+ @Override
+ public String[] getProvidedSourceNames() {
return PROVIDED_SOURCE_NAMES;
}
import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
import eu.etaxonomy.taxeditor.io.ExportManager;
import eu.etaxonomy.taxeditor.io.ImportManager;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart;
return instance;
} else if (instance == null || !instance.isConnected) {
- StoreUtil
+ AbstractUtility
.warningDialog(
"Application is not connected to a datastore",
instance,
"The requested operation is only available when "
- + "connected to a datasource. You may choose a datasource to connect to or create a new one in the datasource view.");
+ + "connected to a datasource. You may choose a datasource to connect to or create a new one in the datasource view.");
- StoreUtil.showView(CdmDataSourceViewPart.ID);
+ AbstractUtility.showView(CdmDataSourceViewPart.ID);
}
*/
/**
- * <p>
- * getDefaultLanguage
- * </p>
+ * Provides access to the global default language set in the application preferences.
*
* @return a {@link eu.etaxonomy.cdm.model.common.Language} object.
*/