Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2013-10-21 18:15:38 -0400
committerChristian W. Damus2013-10-24 11:47:06 -0400
commit54ffdfab85fe85818470b2ff23e4c75b34c00aef (patch)
tree1373494ddf9d9e02893e8e934368a32a845d2b1b
parent9468c92b9cd75b7c3447ef5004a6b6a06454b80c (diff)
downloadcdo-committers/cdamus/passwords-1.tar.gz
cdo-committers/cdamus/passwords-1.tar.xz
cdo-committers/cdamus/passwords-1.zip
[418452] [Security] Simplified security model editorcommitters/cdamus/passwords-1
https://bugs.eclipse.org/bugs/show_bug.cgi?id=418452 Add a Reset Password button to the details panel for Users.
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractDetailsPage.java14
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityPage.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UserDetailsPage.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/messages/Messages.java4
-rw-r--r--plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/messages/messages.properties2
5 files changed, 60 insertions, 2 deletions
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractDetailsPage.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractDetailsPage.java
index 49ff16bbb9..bc1ee5067e 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractDetailsPage.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/AbstractDetailsPage.java
@@ -44,6 +44,7 @@ import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -289,6 +290,19 @@ public abstract class AbstractDetailsPage<T extends EObject> extends AbstractSec
return result;
}
+ protected Button button(Composite parent, FormToolkit toolkit, String label, SelectionListener selectionListener)
+ {
+ Button result = toolkit.createButton(parent, label, SWT.PUSH);
+ result.setLayoutData(layoutData(parent, SWT.LEFT, false, 2));
+
+ getContext().bindValue(SWTObservables.observeEnabled(result), getValue(), null,
+ ObjectExistsConverter.createUpdateValueStrategy());
+
+ result.addSelectionListener(selectionListener);
+
+ return result;
+ }
+
protected ComboViewer combo(Composite parent, FormToolkit toolkit, String label, EAttribute attribute)
{
toolkit.createLabel(parent, label);
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityPage.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityPage.java
index 2b0c1faeb7..89d6a593ef 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityPage.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/CDOSecurityPage.java
@@ -336,8 +336,8 @@ public class CDOSecurityPage extends FormPage
private IAction createEditAdvancedAction()
{
- return new Action("Open Advanced Editor", ExtendedImageRegistry.getInstance().getImageDescriptor(
- URI.createPlatformPluginURI(OM.BUNDLE_ID + "/icons/full/elcl16/advanced.gif", true)))
+ return new Action(Messages.CDOSecurityPage_0, ExtendedImageRegistry.getInstance().getImageDescriptor(
+ URI.createPlatformPluginURI(OM.BUNDLE_ID + "/icons/full/elcl16/advanced.gif", true))) //$NON-NLS-1$
{
@Override
public void run()
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UserDetailsPage.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UserDetailsPage.java
index 7fea6a4bb0..c6f841bb06 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UserDetailsPage.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/editor/UserDetailsPage.java
@@ -13,10 +13,18 @@ package org.eclipse.emf.cdo.security.internal.ui.editor;
import org.eclipse.emf.cdo.security.SecurityPackage;
import org.eclipse.emf.cdo.security.User;
import org.eclipse.emf.cdo.security.internal.ui.messages.Messages;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.view.CDOView;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -46,6 +54,14 @@ public class UserDetailsPage extends AbstractDetailsPage<User>
space(parent, toolkit);
checkbox(parent, toolkit, Messages.UserDetailsPage_5, SecurityPackage.Literals.USER__LOCKED);
+ button(parent, toolkit, Messages.UserDetailsPage_9, new SelectionAdapter()
+ {
+ @Override
+ public void widgetSelected(SelectionEvent e)
+ {
+ resetPassword(getInput());
+ }
+ });
space(parent, toolkit);
@@ -58,4 +74,26 @@ public class UserDetailsPage extends AbstractDetailsPage<User>
oneToMany(parent, toolkit, Messages.UserDetailsPage_8, SecurityPackage.Literals.ASSIGNEE__ROLES);
}
+ private void resetPassword(final User user)
+ {
+ new Job(Messages.UserDetailsPage_9)
+ {
+
+ @Override
+ public IStatus run(IProgressMonitor monitor)
+ {
+ CDOView view = user.cdoView();
+ if (!view.isClosed())
+ {
+ CDOSession session = view.getSession();
+ if (!session.isClosed())
+ {
+ session.resetCredentials(user.getId());
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
}
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/messages/Messages.java b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/messages/Messages.java
index 93ace1a613..5244075a19 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/messages/Messages.java
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/messages/Messages.java
@@ -27,6 +27,8 @@ public class Messages extends NLS
public static String CDOSecurityFormEditor_1;
+ public static String CDOSecurityPage_0;
+
public static String CDOSecurityPage_1;
public static String CDOSecurityPage_2;
@@ -103,6 +105,8 @@ public class Messages extends NLS
public static String UserDetailsPage_8;
+ public static String UserDetailsPage_9;
+
public static String UsersSection_0;
static
{
diff --git a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/messages/messages.properties b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/messages/messages.properties
index 5e07b4c535..a9ac5d3339 100644
--- a/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/messages/messages.properties
+++ b/plugins/org.eclipse.emf.cdo.security.ui/src/org/eclipse/emf/cdo/security/internal/ui/messages/messages.properties
@@ -11,6 +11,7 @@ AbstractDetailsPage_0={0} Details
AbstractDetailsPage_3=Revert to default
CDOSecurityFormEditor_0=Save Failed
CDOSecurityFormEditor_1=Error committing changes to the repository.
+CDOSecurityPage_0=Open Advanced Editor
CDOSecurityPage_1=Manage Security
CDOSecurityPage_2=Security Management
CDOSecurityPage_3=The security resource or the current repository view is read-only.
@@ -49,4 +50,5 @@ UserDetailsPage_5=Locked
UserDetailsPage_6=Access Override:
UserDetailsPage_7=Groups:
UserDetailsPage_8=Roles:
+UserDetailsPage_9=Reset Password...
UsersSection_0=Users

Back to the top