[pve-devel] r5588 - in pve-manager/pve2: lib/PVE www/manager/window
svn-commits at proxmox.com
svn-commits at proxmox.com
Tue Feb 22 15:01:40 CET 2011
Author: dietmar
Date: 2011-02-22 15:01:40 +0100 (Tue, 22 Feb 2011)
New Revision: 5588
Modified:
pve-manager/pve2/lib/PVE/REST.pm
pve-manager/pve2/www/manager/window/LoginWindow.js
Log:
display 'realm' at login window
Modified: pve-manager/pve2/lib/PVE/REST.pm
===================================================================
--- pve-manager/pve2/lib/PVE/REST.pm 2011-02-22 14:00:39 UTC (rev 5587)
+++ pve-manager/pve2/lib/PVE/REST.pm 2011-02-22 14:01:40 UTC (rev 5588)
@@ -300,10 +300,17 @@
my $euid = $>;
- if ($rel_uri eq '/ticket') {
+ if ($rel_uri eq '/realms' && $method eq 'GET') {
+
+ return { status => HTTP_OK,
+ data => $rpcenv->realm_list() };
+
+ } elsif ($rel_uri eq '/ticket') {
my $user = $params->{username} || '';
my $pw = $params->{password} || '';
+ $user .= "\@$params->{realm}" if $params->{realm};
+
if (!$rpcenv->user_enabled($user)) {
return {
status => HTTP_FORBIDDEN,
Modified: pve-manager/pve2/www/manager/window/LoginWindow.js
===================================================================
--- pve-manager/pve2/www/manager/window/LoginWindow.js 2011-02-22 14:00:39 UTC (rev 5587)
+++ pve-manager/pve2/www/manager/window/LoginWindow.js 2011-02-22 14:01:40 UTC (rev 5588)
@@ -31,9 +31,49 @@
initComponent: function() {
var self = this;
+ var realmstore = new Ext.data.JsonStore({
+ url: "/api2/json/realms",
+ autoDestory: true,
+ root: 'data',
+ restful: true, // use GET, not POST
+ fields: [ 'id', 'comment', 'default' ],
+ idProperty: 'id',
+ sortInfo: { field: 'id', order: 'DESC' }
+ });
+
+ var combo = new Ext.form.ComboBox({
+ fieldLabel: 'Realm',
+ hiddenName: 'realm',
+ store: realmstore,
+ mode: 'local',
+ allowBlank: false,
+ forceSelection: true,
+ autoSelect: false,
+ triggerAction: 'all',
+ valueField: 'id',
+ displayField: 'comment'
+ });
+
+ realmstore.load({
+ callback: function(r, o, success) {
+ if (success) {
+ var def;
+ if (r[0] && r[0].data)
+ def = r[0].data.id;
+ Ext.each(r, function(record) {
+ if (record.data && record.data["default"])
+ def = record.data.id;
+ });
+ if (def)
+ combo.setValue(def);
+ }
+ }
+ });
+
+
Ext.apply(self, {
- width: 300,
- height: 125,
+ width: 400,
+ height: 160,
modal: true,
border: false,
draggable: false,
@@ -91,7 +131,8 @@
}
}
}
- }
+ },
+ combo
],
buttons: [
{
More information about the pve-devel
mailing list