mirror of
https://github.com/OpenNebula/one.git
synced 2026-11-20 11:52:37 +09:00
feature #2761: Add SSH key from the settings dialog
This commit is contained in:
1 parent
d3d21ecfb5
commit
1360cfbd89
4 files changed
+61
-9
No files matched your search
@@ -1 +1 @@
|
||||
meta.foundation-version {font-family:"/5.4.6/";}meta.foundation-mq-small {font-family:"/only screen/";width:0em;}meta.foundation-mq-medium {font-family:"/only screen and (min-width:40.063em)/";width:40.063em;}meta.foundation-mq-large {font-family:"/only screen and (min-width:64.063em)/";width:64.063em;}meta.foundation-mq-xlarge {font-family:"/only screen and (min-width:90.063em)/";width:90.063em;}meta.foundation-mq-xxlarge {font-family:"/only screen and (min-width:120.063em)/";width:120.063em;}meta.foundation-data-attribute-namespace {font-family:false;}html ,body {height:100%;}* ,*:before ,*:after {-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}html ,body {font-size:100%;}body {background:#ffffff;color:#555555;padding:0;margin:0;font-family:"Open Sans",sans-serif;font-weight:normal;font-style:normal;line-height:1.5;position:relative;cursor:auto;}a:hover {cursor:pointer;}img {max-width:100%;height:auto;}img {-ms-interpolation-mode:bicubic;}#map_canvas img ,#map_canvas embed ,#map_canvas object ,.map_canvas img ,.map_canvas embed ,.map_canvas object {max-width:none !important;}.left {float:left !important;}.right {float:right !important;}.clearfix:before ,.clearfix:after {content:" ";display:table;}.clearfix:after {clear:both;}.hide {display:none;}.antialiased {-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}img {display:inline-block;vertical-align:middle;}textarea {height:auto;min-height:50px;}select {width:100%;}.row {width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:75rem;}.row:before ,.row:after {content:" ";display:table;}.row:after {clear:both;}.row.collapse>.column ,.row.collapse>.columns {padding-left:0;padding-right:0;}.row.collapse .row {margin-left:0;margin-right:0;}.row .row {width:auto;margin-left:-0.9375rem;margin-right:-0.9375rem;margin-top:0;margin-bottom:0;max-width:none;}.row .row:before ,.row .row:after {content:" ";display:table;}.row .row:after {clear:both;}.row .row.collapse {width:auto;margin:0;max-width:none;}.row .row.collapse:before ,.row .row.collapse:after {content:" ";display:table;}.row .row.collapse:after {clear:both;}.column ,.columns {padding-left:0.9375rem;padding-right:0.9375rem;width:100%;float:left;}[class*="column"]+[class*="column"]:last-child {float:right;}[class*="column"]+[class*="column"].end {float:left;}@media only screen{.small-push-0 {position:relative;left:0%;right:auto;}.small-pull-0 {position:relative;right:0%;left:auto;}.small-push-1 {position:relative;left:8.33333%;right:auto;}.small-pull-1 {position:relative;right:8.33333%;left:auto;}.small-push-2 {position:relative;left:16.66667%;right:auto;}.small-pull-2 {position:relative;right:16.66667%;left:auto;}.small-push-3 {position:relative;left:25%;right:auto;}.small-pull-3 {position:relative;right:25%;left:auto;}.small-push-4 {position:relative;left:33.33333%;right:auto;}.small-pull-4 {position:relative;right:33.33333%;left:auto;}.small-push-5 {position:relative;left:41.66667%;right:auto;}.small-pull-5 {position:relative;right:41.66667%;left:auto;}.small-push-6 {position:relative;left:50%;right:auto;}.small-pull-6 {position:relative;right:50%;left:auto;}.small-push-7 {position:relative;left:58.33333%;right:auto;}.small-pull-7 {position:relative;right:58.33333%;left:auto;}.small-push-8 {position:relative;left:66.66667%;right:auto;}.small-pull-8 {position:relative;right:66.66667%;left:auto;}.small-push-9 {position:relative;left:75%;right:auto;}.small-pull-9 {position:relative;right:75%;left:auto;}.small-push-10 {position:relative;left:83.33333%;right:auto;}.small-pull-10 {position:relative;right:83.33333%;left:auto;}.small-push-11 {position:relative;left:91.66667%;right:auto;}.small-pull-11 {position:relative;right:91.66667%;left:auto;}.column ,.columns {position:relative;padding-left:0.9375rem;padding-right:0.9375rem;float:left;}.small-1 {width:8.33333%;}.small-2 {width:16.66667%;}.small-3 {width:25%;}.small-4 {width:33.33333%;}.small-5 {width:41.66667%;}.small-6 {width:50%;}.small-7 {width:58.33333%;}.small-8 {width:66.66667%;}.small-9 {width:75%;}.small-10 {width:83.33333%;}.small-11 {width:91.66667%;}.small-12 {width:100%;}.small-offset-0 {margin-left:0% !important;}.small-offset-1 {margin-left:8.33333% !important;}.small-offset-2 {margin-left:16.66667% !important;}.small-offset-3 {margin-left:25% !important;}.small-offset-4 {margin-left:33.33333% !important;}.small-offset-5 {margin-left:41.66667% !important;}.small-offset-6 {margin-left:50% !important;}.small-offset-7 {margin-left:58.33333% !important;}.small-offset-8 {margin-left:66.66667% !important;}.small-offset-9 {margin-left:75% !important;}.small-offset-10 {margin-left:83.33333% !important;}.small-offset-11 {margin-left:91.66667% !important;}.small-reset-order {margin-left:0;margin-right:0;left:auto;right:auto;float:left;}.column.small-centered ,.columns.small-centered {margin-left:auto;margin-right:auto;float:none;}.column.small-uncentered ,.columns.small-uncenLine truncated
|
||||
meta.foundation-version {font-family:"/5.4.6/";}meta.foundation-mq-small {font-family:"/only screen/";width:0em;}meta.foundation-mq-medium {font-family:"/only screen and (min-width:40.063em)/";width:40.063em;}meta.foundation-mq-large {font-family:"/only screen and (min-width:64.063em)/";width:64.063em;}meta.foundation-mq-xlarge {font-family:"/only screen and (min-width:90.063em)/";width:90.063em;}meta.foundation-mq-xxlarge {font-family:"/only screen and (min-width:120.063em)/";width:120.063em;}meta.foundation-data-attribute-namespace {font-family:false;}html ,body {height:100%;}* ,*:before ,*:after {-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;}html ,body {font-size:100%;}body {background:#ffffff;color:#555555;padding:0;margin:0;font-family:"Open Sans",sans-serif;font-weight:normal;font-style:normal;line-height:1.5;position:relative;cursor:auto;}a:hover {cursor:pointer;}img {max-width:100%;height:auto;}img {-ms-interpolation-mode:bicubic;}#map_canvas img ,#map_canvas embed ,#map_canvas object ,.map_canvas img ,.map_canvas embed ,.map_canvas object {max-width:none !important;}.left {float:left !important;}.right {float:right !important;}.clearfix:before ,.clearfix:after {content:" ";display:table;}.clearfix:after {clear:both;}.hide {display:none;}.antialiased {-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}img {display:inline-block;vertical-align:middle;}textarea {height:auto;min-height:50px;}select {width:100%;}.row {width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:75rem;}.row:before ,.row:after {content:" ";display:table;}.row:after {clear:both;}.row.collapse>.column ,.row.collapse>.columns {padding-left:0;padding-right:0;}.row.collapse .row {margin-left:0;margin-right:0;}.row .row {width:auto;margin-left:-0.9375rem;margin-right:-0.9375rem;margin-top:0;margin-bottom:0;max-width:none;}.row .row:before ,.row .row:after {content:" ";display:table;}.row .row:after {clear:both;}.row .row.collapse {width:auto;margin:0;max-width:none;}.row .row.collapse:before ,.row .row.collapse:after {content:" ";display:table;}.row .row.collapse:after {clear:both;}.column ,.columns {padding-left:0.9375rem;padding-right:0.9375rem;width:100%;float:left;}[class*="column"]+[class*="column"]:last-child {float:right;}[class*="column"]+[class*="column"].end {float:left;}@media only screen{.small-push-0 {position:relative;left:0%;right:auto;}.small-pull-0 {position:relative;right:0%;left:auto;}.small-push-1 {position:relative;left:8.33333%;right:auto;}.small-pull-1 {position:relative;right:8.33333%;left:auto;}.small-push-2 {position:relative;left:16.66667%;right:auto;}.small-pull-2 {position:relative;right:16.66667%;left:auto;}.small-push-3 {position:relative;left:25%;right:auto;}.small-pull-3 {position:relative;right:25%;left:auto;}.small-push-4 {position:relative;left:33.33333%;right:auto;}.small-pull-4 {position:relative;right:33.33333%;left:auto;}.small-push-5 {position:relative;left:41.66667%;right:auto;}.small-pull-5 {position:relative;right:41.66667%;left:auto;}.small-push-6 {position:relative;left:50%;right:auto;}.small-pull-6 {position:relative;right:50%;left:auto;}.small-push-7 {position:relative;left:58.33333%;right:auto;}.small-pull-7 {position:relative;right:58.33333%;left:auto;}.small-push-8 {position:relative;left:66.66667%;right:auto;}.small-pull-8 {position:relative;right:66.66667%;left:auto;}.small-push-9 {position:relative;left:75%;right:auto;}.small-pull-9 {position:relative;right:75%;left:auto;}.small-push-10 {position:relative;left:83.33333%;right:auto;}.small-pull-10 {position:relative;right:83.33333%;left:auto;}.small-push-11 {position:relative;left:91.66667%;right:auto;}.small-pull-11 {position:relative;right:91.66667%;left:auto;}.column ,.columns {position:relative;padding-left:0.9375rem;padding-right:0.9375rem;float:left;}.small-1 {width:8.33333%;}.small-2 {width:16.66667%;}.small-3 {width:25%;}.small-4 {width:33.33333%;}.small-5 {width:41.66667%;}.small-6 {width:50%;}.small-7 {width:58.33333%;}.small-8 {width:66.66667%;}.small-9 {width:75%;}.small-10 {width:83.33333%;}.small-11 {width:91.66667%;}.small-12 {width:100%;}.small-offset-0 {margin-left:0% !important;}.small-offset-1 {margin-left:8.33333% !important;}.small-offset-2 {margin-left:16.66667% !important;}.small-offset-3 {margin-left:25% !important;}.small-offset-4 {margin-left:33.33333% !important;}.small-offset-5 {margin-left:41.66667% !important;}.small-offset-6 {margin-left:50% !important;}.small-offset-7 {margin-left:58.33333% !important;}.small-offset-8 {margin-left:66.66667% !important;}.small-offset-9 {margin-left:75% !important;}.small-offset-10 {margin-left:83.33333% !important;}.small-offset-11 {margin-left:91.66667% !important;}.small-reset-order {margin-left:0;margin-right:0;left:auto;right:auto;float:left;}.column.small-centered ,.columns.small-centered {margin-left:auto;margin-right:auto;float:none;}.column.small-uncentered ,.columns.small-uncenLine truncated
|
||||
@@ -129,6 +129,20 @@ var config_tab_content =
|
||||
</tbody>\
|
||||
</table>\
|
||||
</div>\
|
||||
<div class="large-5 columns">' +
|
||||
'<table class="dataTable extended_table" cellpadding="0" cellspacing="0" border="0">\
|
||||
<thead>\
|
||||
<tr>\
|
||||
<th>' + tr("Public SSH Key") + '</th>\
|
||||
<th>\
|
||||
<a class="config_ssh_public_key_edit right" href="#"><i class="fa fa-pencil-square-o"></i></a>\
|
||||
</th>\
|
||||
</tr>\
|
||||
</thead>\
|
||||
</table>\
|
||||
<textarea rows="6" type="text" id="config_ssh_public_key_textarea" name="ssh_public_key" class="hidden"/>\
|
||||
<p id="config_ssh_public_key_text" name="ssh_public_key"></p>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="row">\
|
||||
<div id="setting_user_template" class="large-12 columns">'+
|
||||
@@ -294,6 +308,38 @@ function setupConfigDialog() {
|
||||
|
||||
dialog.addClass("reveal-modal large max-height").attr("data-reveal", "");
|
||||
|
||||
$(".config_ssh_public_key_edit", '#config_dialog').on("click", function(){
|
||||
$("#config_ssh_public_key_text", '#config_dialog').hide();
|
||||
$("#config_ssh_public_key_textarea", '#config_dialog').show().focus();
|
||||
});
|
||||
|
||||
$("#config_ssh_public_key_textarea", '#config_dialog').on("change", function(){
|
||||
var user_id = getSelectedNodes(dataTable_users)[0];
|
||||
|
||||
OpenNebula.User.show({
|
||||
data : {
|
||||
id: -1
|
||||
},
|
||||
success: function(request,user_json){
|
||||
var template = user_json.USER.TEMPLATE;
|
||||
|
||||
template["SSH_PUBLIC_KEY"] = $("#config_ssh_public_key_textarea", '#config_dialog').val();
|
||||
|
||||
template_str = "";
|
||||
$.each(template,function(key,value){
|
||||
template_str += (key + '=' + '"' + value + '"\n');
|
||||
});
|
||||
|
||||
Sunstone.runAction("UserSettings.update_template", -1, template_str);
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
$("#config_ssh_public_key_textarea", '#config_dialog').on("focusout", function(){
|
||||
$("#config_ssh_public_key_text", '#config_dialog').show();
|
||||
$("#config_ssh_public_key_textarea", '#config_dialog').hide();
|
||||
});
|
||||
|
||||
setupTips(dialog);
|
||||
|
||||
if (config['user_config']["vnc_wss"] == "yes"){
|
||||
@@ -415,11 +461,22 @@ function updateUserConfigInfo(request,user_json) {
|
||||
<td class="value_td" colspan="2"><button id="update_password" type="button" class="button tiny radius" >' + tr("Update password") + '</button></td>\
|
||||
</tr>')
|
||||
|
||||
var ssh_key;
|
||||
if (info.TEMPLATE.SSH_PUBLIC_KEY) {
|
||||
ssh_key = info.TEMPLATE.SSH_PUBLIC_KEY;
|
||||
delete info.TEMPLATE.SSH_PUBLIC_KEY;
|
||||
$("#config_ssh_public_key_text", "#config_dialog").text(ssh_key);
|
||||
$("#config_ssh_public_key_textarea", "#config_dialog").val(ssh_key);
|
||||
} else {
|
||||
$("#config_ssh_public_key_text", "#config_dialog").text(tr("You can provide a SSH Key for this User clicking on the edit button"))
|
||||
};
|
||||
|
||||
$("#setting_user_template").html(
|
||||
insert_extended_template_table(info.TEMPLATE,
|
||||
"UserSettings",
|
||||
"-1",
|
||||
tr("Custom Attributes"))
|
||||
tr("Custom Attributes"),
|
||||
{SSH_PUBLIC_KEY: ssh_key})
|
||||
)
|
||||
|
||||
$("#div_edit_chg_group_link").die();
|
||||
|
||||
@@ -594,7 +594,7 @@ function updateUserInfo(request,user){
|
||||
</thead>\
|
||||
</table>\
|
||||
<textarea rows="6" type="text" id="user_ssh_public_key_textarea" name="ssh_public_key" class="hidden"/>\
|
||||
<p id="user_ssh_public_key_text" name="ssh_public_key" style="font-size: 0.875rem; color: #777; padding: 0px 10px; overflow-x:hidden; text-overflow: ellipsis; height: 120px;">'+tr("You can provide a SSH Key for this User clicking on the edit button")+'</p>\
|
||||
<p id="user_ssh_public_key_text" name="ssh_public_key">'+tr("You can provide a SSH Key for this User clicking on the edit button")+'</p>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="row">\
|
||||
@@ -642,11 +642,6 @@ function updateUserInfo(request,user){
|
||||
Config.isTabActionEnabled("users-tab", "User.quotas_dialog"),
|
||||
"User");
|
||||
|
||||
if (ssh_key) {
|
||||
$("#user_ssh_public_key_text", "#user_info_panel").text(ssh_key);
|
||||
$("#user_ssh_public_key_textarea", "#user_info_panel").val(ssh_key);
|
||||
}
|
||||
|
||||
$(".user_ssh_public_key_edit", "#user_info_panel").on("click", function(){
|
||||
$("#user_ssh_public_key_text", "#user_info_panel").hide();
|
||||
$("#user_ssh_public_key_textarea", "#user_info_panel").show().focus();
|
||||
|
||||
@@ -1118,7 +1118,7 @@ hr {
|
||||
}
|
||||
}
|
||||
|
||||
#ssh_pulic_key_text {
|
||||
#user_ssh_public_key_text, #config_ssh_public_key_text {
|
||||
font-size: 0.875rem;
|
||||
color: #777;
|
||||
padding: 0px 10px;
|
||||
|
||||
Reference in new issue
Block a user