useradmin/userauth updates for use outside nws

This commit is contained in:
Michael James 2016-10-29 13:03:04 -05:00
parent ce1109c6e2
commit 9749b1d745
12 changed files with 46 additions and 111 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.raytheon.uf.viz.plugin.nwsauth</name>
<name>com.raytheon.uf.viz.plugin.userauth</name>
<comment></comment>
<projects>
</projects>

View file

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Nws Auth Plug-in
Bundle-SymbolicName: com.raytheon.uf.viz.plugin.nwsauth;singleton:=true
Bundle-SymbolicName: com.raytheon.uf.viz.plugin.userauth;singleton:=true
Bundle-Version: 1.14.0.qualifier
Bundle-Vendor: RAYTHEON
Require-Bundle: org.eclipse.core.runtime,
@ -10,4 +10,4 @@ Require-Bundle: org.eclipse.core.runtime,
com.raytheon.uf.viz.core
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.uf.viz.plugin.nwsauth
Export-Package: com.raytheon.uf.viz.plugin.userauth

View file

@ -4,7 +4,7 @@
<extension
point="com.raytheon.uf.viz.core.userManager">
<userManager
class="com.raytheon.uf.viz.plugin.nwsauth.NwsUserManager">
class="com.raytheon.uf.viz.core.auth.BasicUserManager">
</userManager>
</extension>

View file

@ -1,79 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.plugin.nwsauth;
import java.util.List;
import com.raytheon.uf.common.auth.user.IPermission;
import com.raytheon.uf.common.auth.user.IRole;
import com.raytheon.uf.viz.core.auth.BasicUserManager;
import com.raytheon.uf.viz.core.requests.INotAuthHandler;
/**
* Implementation of IUserManager
*
* <pre>
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 27, 2010 rgeorge Initial creation
* Jun 07, 2013 1981 mpduff Add an IUser field.
* Oct 06, 2014 3398 bclement now extends BasicUserManager
*
* </pre>
*
* @author rgeorge
* @version 1.0
*/
public class NwsUserManager extends BasicUserManager {
private final NwsNotAuthHandler notAuthHandler = new NwsNotAuthHandler();
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.core.auth.IUserManager#getNotAuthHandler()
*/
@Override
public INotAuthHandler getNotAuthHandler() {
return notAuthHandler;
}
/**
* {@inheritDoc}
*/
@Override
public List<IPermission> getPermissions(String application) {
// TODO: Should this pass through to EDEX to get this stuff?
return NwsRoleDataManager.getInstance().getPermissions(application);
}
/**
* {@inheritDoc}
*/
@Override
public List<IRole> getRoles(String application) {
// TODO: Should this pass through to EDEX to get this stuff?
return NwsRoleDataManager.getInstance().getRoles(application);
}
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.plugin.nwsauth;
package com.raytheon.uf.viz.plugin.userauth;
import com.raytheon.uf.common.auth.req.AbstractPrivilegedRequest;
import com.raytheon.uf.common.auth.resp.UserNotAuthenticated;
@ -44,7 +44,7 @@ import com.raytheon.uf.viz.core.requests.INotAuthHandler;
* @version 1.0
*/
public class NwsNotAuthHandler implements INotAuthHandler {
public class UserNotAuthHandler implements INotAuthHandler {
/*
* (non-Javadoc)
@ -61,7 +61,7 @@ public class NwsNotAuthHandler implements INotAuthHandler {
String message = "User: <" + user.uniqueId()
+ "> is not authenticated to perform request:"
+ request.getClass();
UFStatus.getHandler(NwsNotAuthHandler.class).handle(Priority.PROBLEM,
UFStatus.getHandler(UserNotAuthHandler.class).handle(Priority.PROBLEM,
message);
throw new VizException(message);
}
@ -80,7 +80,7 @@ public class NwsNotAuthHandler implements INotAuthHandler {
message = "Error sending request for user: "
+ response.getRequest().getUser().uniqueId().toString();
}
UFStatus.getHandler(NwsNotAuthHandler.class).handle(Priority.PROBLEM,
UFStatus.getHandler(UserNotAuthHandler.class).handle(Priority.PROBLEM,
message);
throw new VizException(message);
}

View file

@ -17,7 +17,7 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.viz.plugin.nwsauth;
package com.raytheon.uf.viz.plugin.userauth;
import java.util.ArrayList;
import java.util.Arrays;
@ -60,16 +60,16 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
* @version 1.0
*/
public class NwsRoleDataManager {
public class UserRoleDataManager {
/** Status handler */
private static final IUFStatusHandler statusHandler = UFStatus
.getHandler(NwsRoleDataManager.class);
.getHandler(UserRoleDataManager.class);
private static final NwsRoleDataManager instance = new NwsRoleDataManager();
private static final UserRoleDataManager instance = new UserRoleDataManager();
private Map<String, NwsRoleData> roleDataMap = new HashMap<String, NwsRoleData>();
private NwsRoleDataManager() {
private UserRoleDataManager() {
retrieveRoleDataFromServer();
}
@ -78,7 +78,7 @@ public class NwsRoleDataManager {
*
* @return an instance
*/
public static NwsRoleDataManager getInstance() {
public static UserRoleDataManager getInstance() {
return instance;
}

View file

@ -36,4 +36,18 @@
install-size="0"
version="0.0.0"/>
<plugin
id="com.raytheon.uf.common.plugin.nwsauth"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.raytheon.uf.viz.plugin.userauth"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.uf.viz.localization;bundle-version="1.12.1174",
com.raytheon.uf.common.auth;bundle-version="1.12.1174",
com.raytheon.uf.common.useradmin;bundle-version="1.0.0",
com.raytheon.uf.viz.plugin.nwsauth;bundle-version="1.12.1174"
com.raytheon.uf.viz.plugin.userauth;bundle-version="1.12.1174"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Import-Package: com.raytheon.uf.common.plugin.nwsauth.xml

View file

@ -36,14 +36,14 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.plugin.nwsauth.xml.NwsRoleData;
import com.raytheon.uf.common.plugin.nwsauth.xml.RoleXML;
import com.raytheon.uf.common.plugin.nwsauth.xml.UserXML;
import com.raytheon.uf.viz.plugin.nwsauth.NwsRoleDataManager;
import com.raytheon.uf.viz.plugin.userauth.UserRoleDataManager;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.widgets.duallist.DualList;
import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
import com.raytheon.viz.ui.widgets.duallist.IUpdate;
/**
* Edit user di
* Edit user dialog.
*
* <pre>
*
@ -178,7 +178,7 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
stackComp.setLayout(stackLayout);
stackComp.setLayoutData(gd);
NwsRoleDataManager manager = NwsRoleDataManager.getInstance();
UserRoleDataManager manager = UserRoleDataManager.getInstance();
ArrayList<String> selectedList = new ArrayList<String>();
ArrayList<String> fullList = new ArrayList<String>();
String availableLabel = "Available Roles:";
@ -309,7 +309,7 @@ public class ManageUserDlg extends CaveSWTDialog implements IUpdate {
String[] permissions = permDualList.getSelectedListItems();
String[] roles = roleDualList.getSelectedListItems();
NwsRoleDataManager man = NwsRoleDataManager.getInstance();
UserRoleDataManager man = UserRoleDataManager.getInstance();
NwsRoleData roleData = man.getRoleData(application);
if (type.equalsIgnoreCase("User")) {

View file

@ -31,7 +31,7 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.plugin.nwsauth.xml.NwsRoleData;
import com.raytheon.uf.viz.plugin.nwsauth.NwsRoleDataManager;
import com.raytheon.uf.viz.plugin.userauth.UserRoleDataManager;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
@ -154,7 +154,7 @@ public class NewDlg extends CaveSWTDialog {
private void handleOK() {
if (newTextField.getText() != null && newTextField.getText().length() > 0) {
NwsRoleDataManager manager = NwsRoleDataManager.getInstance();
UserRoleDataManager manager = UserRoleDataManager.getInstance();
NwsRoleData roleData = manager.getRoleData(application);
if (type.equalsIgnoreCase("User")) {
roleData.addUser(newTextField.getText().trim());

View file

@ -50,7 +50,7 @@ import com.raytheon.uf.common.plugin.nwsauth.xml.RoleXML;
import com.raytheon.uf.common.useradmin.request.UserAdminConstants;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob;
import com.raytheon.uf.viz.plugin.nwsauth.NwsRoleDataManager;
import com.raytheon.uf.viz.plugin.userauth.UserRoleDataManager;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
@ -131,7 +131,7 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
*/
@Override
protected void initializeComponents(Shell shell) {
NwsRoleDataManager man = NwsRoleDataManager.getInstance();
UserRoleDataManager man = UserRoleDataManager.getInstance();
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
GridLayout gl = new GridLayout(1, false);
shell.setLayout(gl);
@ -214,7 +214,7 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
+ "Are you sure you want to close without saving?");
int answer = messageDialog.open();
if (answer == SWT.YES) {
NwsRoleDataManager.getInstance().reloadRoleData();
UserRoleDataManager.getInstance().reloadRoleData();
close();
return;
}
@ -495,7 +495,7 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
* Populates Lists
*/
private void populateLists() {
NwsRoleDataManager man = NwsRoleDataManager.getInstance();
UserRoleDataManager man = UserRoleDataManager.getInstance();
if (appCombo.isDisposed() || userList.isDisposed()
|| userTab.isDisposed() || roleTab.isDisposed()
|| roleList.isDisposed()) {
@ -544,7 +544,7 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
* Populates User Role List.
*/
private void populateUserRoleList() {
NwsRoleDataManager man = NwsRoleDataManager.getInstance();
UserRoleDataManager man = UserRoleDataManager.getInstance();
if (appCombo.isDisposed() || userList.isDisposed()
|| userPermList.isDisposed()) {
return;
@ -576,7 +576,7 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
* Populates Permission List.
*/
private void populatePermissionList() {
NwsRoleDataManager man = NwsRoleDataManager.getInstance();
UserRoleDataManager man = UserRoleDataManager.getInstance();
rolePermList.removeAll();
String app = appCombo.getItem(appCombo.getSelectionIndex());
if (roleList.getSelectionIndex() != -1) {
@ -611,7 +611,7 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
int response = messageDialog.open();
if (response == SWT.YES) {
NwsRoleDataManager man = NwsRoleDataManager.getInstance();
UserRoleDataManager man = UserRoleDataManager.getInstance();
String app = appCombo.getItem(appCombo.getSelectionIndex());
man.deleteUser(user, app);
dirty = true;
@ -646,7 +646,7 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
int response = messageDialog.open();
if (response == SWT.YES) {
NwsRoleDataManager man = NwsRoleDataManager.getInstance();
UserRoleDataManager man = UserRoleDataManager.getInstance();
String app = appCombo.getItem(appCombo.getSelectionIndex());
man.deleteRole(role, app);
dirty = true;
@ -700,7 +700,7 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
String selection = list.getItem(list.getSelectionIndex());
StringBuilder messageText = new StringBuilder();
boolean roleFlag = false;
NwsRoleDataManager man = NwsRoleDataManager.getInstance();
UserRoleDataManager man = UserRoleDataManager.getInstance();
for (RoleXML role : man.getRoleData(selectedApplication)
.getRoleList()) {
if (selection.equals(role.getRoleId())) {
@ -778,7 +778,7 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
* Handle OK button.
*/
private void handleOK() {
NwsRoleDataManager manager = NwsRoleDataManager.getInstance();
UserRoleDataManager manager = UserRoleDataManager.getInstance();
manager.save(selectedApplication);
dirty = false;
}
@ -798,7 +798,7 @@ public class UserAdminSelectDlg extends CaveSWTDialog implements
VizApp.runAsync(new Runnable() {
@Override
public void run() {
NwsRoleDataManager.getInstance().reloadRoleData();
UserRoleDataManager.getInstance().reloadRoleData();
if (!UserAdminSelectDlg.this.isDisposed()) {
populateLists();