feature #2761: Easily add ssh keys to any user from the admin view

This commit is contained in:
Daniel Molina committed 2014-12-12 17:07:18 +01:00
1 parent 35b544c8c1
commit d3d21ecfb5
3 files changed
+68 -3

No files matched your search

+1 -1
View File
@@ -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
+58 -2
View File
@@ -537,6 +537,12 @@ function updateUsersView(request,users_list,quotas_list){
function updateUserInfo(request,user){
var info = user.USER;
var ssh_key;
if (info.TEMPLATE.SSH_PUBLIC_KEY) {
ssh_key = info.TEMPLATE.SSH_PUBLIC_KEY;
delete info.TEMPLATE.SSH_PUBLIC_KEY;
};
$(".resource-info-header", $("#users-tab")).html(info.NAME);
var info_tab = {
@@ -577,14 +583,27 @@ function updateUserInfo(request,user){
</table>\
</div>\
<div class="large-6 columns">' +
'</div>\
'<table class="dataTable extended_table" cellpadding="0" cellspacing="0" border="0">\
<thead>\
<tr>\
<th>' + tr("Public SSH Key") + '</th>\
<th>\
<a class="user_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="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>\
</div>\
</div>\
<div class="row">\
<div class="large-9 columns">'+
insert_extended_template_table(info.TEMPLATE,
"User",
info.ID,
tr("Attributes")) +
tr("Attributes"),
{SSH_PUBLIC_KEY: ssh_key}) +
'</div>\
</div>'
};
@@ -622,6 +641,43 @@ function updateUserInfo(request,user){
"#user_info_panel",
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();
});
$("#user_ssh_public_key_textarea", "#user_info_panel").on("change", function(){
var user_id = getSelectedNodes(dataTable_users)[0];
OpenNebula.User.show({
data : {
id: user_id
},
success: function(request,user_json){
var template = user_json.USER.TEMPLATE;
template["SSH_PUBLIC_KEY"] = $("#user_ssh_public_key_textarea", "#user_info_panel").val();
template_str = "";
$.each(template,function(key,value){
template_str += (key + '=' + '"' + value + '"\n');
});
Sunstone.runAction("User.update_template", user_id, template_str);
}
})
});
$("#user_ssh_public_key_textarea", "#user_info_panel").on("focusout", function(){
$("#user_ssh_public_key_text", "#user_info_panel").show();
$("#user_ssh_public_key_textarea", "#user_info_panel").hide();
});
};
// Used also from groups-tabs.js
+9
View File
@@ -1117,3 +1117,12 @@ hr {
margin-top: 15px;
}
}
#ssh_pulic_key_text {
font-size: 0.875rem;
color: #777;
padding: 0px 10px;
overflow-x:hidden;
text-overflow:
ellipsis; height: 120px;
}