usr/src/java/vpanels/panel/org/opensolaris/os/vp/panel/swing/view/AuthPanel.java
author Stephen Talley <stephen.talley@oracle.com>
Mon, 28 Mar 2011 10:53:34 -0400
changeset 685 767674b0a2fb
parent 651 eeb57de7d602
permissions -rw-r--r--
18094 s/StringBuffer/StringBuilder/g
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
     1
/*
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
     2
 * CDDL HEADER START
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
     3
 *
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
     4
 * The contents of this file are subject to the terms of the
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
     5
 * Common Development and Distribution License (the "License").
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
     6
 * You may not use this file except in compliance with the License.
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
     7
 *
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
     8
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
     9
 * or http://www.opensolaris.org/os/licensing.
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    10
 * See the License for the specific language governing permissions
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    11
 * and limitations under the License.
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    12
 *
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    13
 * When distributing Covered Code, include this CDDL HEADER in each
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    14
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    15
 * If applicable, add the following below this CDDL HEADER, with the
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    16
 * fields enclosed by brackets "[]" replaced with your own identifying
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    17
 * information: Portions Copyright [yyyy] [name of copyright owner]
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    18
 *
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    19
 * CDDL HEADER END
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    20
 */
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    21
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    22
/*
651
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
    23
 * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    24
 */
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    25
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    26
package org.opensolaris.os.vp.panel.swing.view;
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    27
266
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    28
import java.awt.BorderLayout;
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    29
import javax.swing.*;
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 306
diff changeset
    30
import org.opensolaris.os.vp.panel.common.*;
591
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 473
diff changeset
    31
import org.opensolaris.os.vp.util.misc.NetUtil;
7c5752b99fd6 12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents: 473
diff changeset
    32
import org.opensolaris.os.vp.util.misc.finder.Finder;
266
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    33
import org.opensolaris.os.vp.util.swing.*;
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    34
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    35
@SuppressWarnings({"serial"})
266
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    36
public class AuthPanel extends JPanel {
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    37
    //
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    38
    // Instance data
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    39
    //
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    40
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    41
    private ConnectionInfo info;
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    42
    private boolean privileged;
266
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    43
    private JLabel label;
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    44
    private JButton button;
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    45
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    46
    //
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    47
    // Constructors
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    48
    //
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    49
266
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    50
    public AuthPanel() {
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    51
	setOpaque(false);
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    52
	label = new JLabel();
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    53
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    54
	button = new JButton();
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    55
	new RolloverHandler(button);
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    56
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    57
	int gap = GUIUtil.getHalfGap();
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    58
	setLayout(new BorderLayout());
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    59
	add(label, BorderLayout.CENTER);
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    60
	add(button, BorderLayout.EAST);
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    61
    }
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    62
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    63
    //
266
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    64
    // AuthPanel methods
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    65
    //
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    66
266
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    67
    public JButton getButton() {
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    68
	return button;
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    69
    }
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    70
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    71
    public ConnectionInfo getConnectionInfo() {
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    72
	return info;
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    73
    }
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    74
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    75
    public boolean getPrivileged() {
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    76
	return privileged;
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    77
    }
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    78
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    79
    public void setConnectionInfo(ConnectionInfo info) {
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    80
	this.info = info;
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    81
	updateAuth();
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    82
    }
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    83
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    84
    public void setPrivileged(boolean privileged) {
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    85
	this.privileged = privileged;
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    86
	updateAuth();
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    87
    }
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    88
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    89
    protected void updateAuth() {
651
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
    90
	label.setText(Finder.getString("auth.label", toString(info, true)));
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    91
266
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    92
	button.setIcon(Finder.getIcon(privileged ?
306
b08061f1d961 9379 integrate visual design icons and feedback
Stephen Talley <stephen.talley@sun.com>
parents: 266
diff changeset
    93
	    "images/auth/lock/authorized-16.png" :
b08061f1d961 9379 integrate visual design icons and feedback
Stephen Talley <stephen.talley@sun.com>
parents: 266
diff changeset
    94
	    "images/auth/lock/unauthorized-16.png"));
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    95
266
b6e25669b646 7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents: 223
diff changeset
    96
	button.setToolTipText(Finder.getString(privileged ?
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    97
	    "auth.tooltip.authorized" : "auth.tooltip.unauthorized"));
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    98
    }
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
    99
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   100
    //
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   101
    // Static methods
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   102
    //
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   103
651
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   104
    public static String toString(String host, String user, String role,
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   105
	String zone, String zoneUser, String zoneRole, boolean shortForm) {
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   106
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 306
diff changeset
   107
	if (NetUtil.isLoopbackAddress(host)) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 306
diff changeset
   108
	    host = NetUtil.getHostName();
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 306
diff changeset
   109
	}
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 306
diff changeset
   110
685
767674b0a2fb 18094 s/StringBuffer/StringBuilder/g
Stephen Talley <stephen.talley@oracle.com>
parents: 651
diff changeset
   111
	StringBuilder resource = new StringBuilder("auth.text");
651
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   112
	if (shortForm) {
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   113
	    resource.append(".short");
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   114
	}
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   115
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   116
	resource.append(".host.user");
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   117
	if (role != null) {
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   118
	    resource.append(".role");
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   119
	}
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 306
diff changeset
   120
651
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   121
	if (zone != null) {
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   122
	    resource.append(".zone.user");
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   123
	    if (zoneRole != null) {
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   124
		resource.append(".role");
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   125
	    }
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   126
	}
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   127
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   128
        return Finder.getString(resource.toString(), host, user, role, zone,
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   129
	    zoneUser, zoneRole);
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 306
diff changeset
   130
    }
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 306
diff changeset
   131
651
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   132
    public static String toString(LoginInfo info, boolean shortForm) {
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   133
	if (info == null) {
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   134
	    return null;
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   135
	}
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   136
651
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   137
        return toString(info.getHost(), info.getUser(), info.getRole(),
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   138
	    info.getZone(), info.getZoneUser(), info.getZoneRole(), shortForm);
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 306
diff changeset
   139
    }
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   140
651
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   141
    public static String toString(LoginRequest request, boolean shortForm) {
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 306
diff changeset
   142
	if (request == null) {
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 306
diff changeset
   143
	    return null;
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   144
	}
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   145
651
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   146
	boolean isZone = request.getZonePrompt().getValue();
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   147
	String zone = isZone ? request.getZone().getValue() : null;
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   148
	String zoneUser = isZone ? request.getZoneUser().getValue() : null;
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   149
	String zoneRole = isZone ? request.getZoneRole().getValue() : null;
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   150
473
18f221b572ce 14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents: 306
diff changeset
   151
        return toString(request.getHost().getValue(),
651
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   152
	    request.getUser().getValue(), request.getRole().getValue(), zone,
eeb57de7d602 17829 rzd - rad connection to zone through its global zone
Stephen Talley <stephen.talley@oracle.com>
parents: 598
diff changeset
   153
	    zoneUser, zoneRole, shortForm);
223
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   154
    }
aa68c366f3d0 6923 Menu, connection pull-down should be removed from main window
Stephen Talley <stephen.talley@sun.com>
parents:
diff changeset
   155
}