cloudstack end-user cantg resize volumes - apache-cloudstack

End users (also Domain admins) can't resize Volumes - there is no such option in CS GUI (see img1.PNG) . While Cloudstack Admin is able resize vols (see img2.PNG).
Info: CS version - 4.8.0 HA management servers behind HAProxy with MariaDb Galera. Host: Xenserver.
img1.png:https://files.fm/u/krgxs9b9#/view/img1.PNG
img2.png: https://files.fm/u/krgxs9b9#/view/img2.PNG

This is fixed in 4.9 by the following PR. API allowed end users to resize but the option wasn't available through UI.
https://github.com/apache/cloudstack/pull/1595
In: /usr/share/cloudstack-management/webapps/client/scripts/storage.js
Removing:
if (jsonObj.hypervisor == "KVM" || jsonObj.hypervisor == "XenServer" || jsonObj.hypervisor == "VMware") {
if (jsonObj.state == "Ready" || jsonObj.state == "Allocated") {
allowedActions.push("resize");
}
And adding:
if (jsonObj.state == "Ready" || jsonObj.state == "Allocated") {
allowedActions.push("resize");
}
Also removing: /usr/share/cloudstack-management/webapps/client/scripts/storage.js.gz
Resolves issue

Related

Azure Disk Encryption using terraform VM extension - forces replacement [Second run]

I created the following resource to encrypt 'All' disk of a VM, and it worked fine so far:
resource "azurerm_virtual_machine_extension" "vm_encry_win" {
count = "${var.vm_encry_os_type == "Windows" ? 1 : 0}"
name = "${var.vm_encry_name}"
location = "${var.vm_encry_location}"
resource_group_name = "${var.vm_encry_rg_name}"
virtual_machine_name = "${var.vm_encry_vm_name}"
publisher = "${var.vm_encry_publisher}"
type = "${var.vm_encry_type}"
type_handler_version = "${var.vm_encry_type_handler_version == "" ? "2.2" : var.vm_encry_type_handler_version}"
auto_upgrade_minor_version = "${var.vm_encry_auto_upgrade_minor_version}"
tags = "${var.vm_encry_tags}"
settings = <<SETTINGS
{
"EncryptionOperation": "${var.vm_encry_operation}",
"KeyVaultURL": "${var.vm_encry_kv_vault_uri}",
"KeyVaultResourceId": "${var.vm_encry_kv_vault_id}",
"KeyEncryptionKeyURL": "${var.vm_encry_kv_key_url}",
"KekVaultResourceId": "${var.vm_encry_kv_vault_id}",
"KeyEncryptionAlgorithm": "${var.vm_encry_key_algorithm}",
"VolumeType": "${var.vm_encry_volume_type}"
}
SETTINGS
}
When i ran the first time - ADE encryption is done for both OS and data disk.
However, When I re-run terraform using terraform plan or terraform apply, it wants to replace all my data disks I have already created, like the following screenshot illustrates.
I do not know how to solve it. And my already created disks should not be replaced.
I check on the lines of ignore_chnages
lifecycle {
ignore_changes = [encryption_settings]
}
I am not sure where to add or does this reference actually solves the problem?
Which resource block should i add them.
Or is there another way ?

ionic server connection unsuccessful when checking internet connection

I'm developing on ionic but I get a problem when I'm checking if there's internet connection.
This is my code for checking if internet connection:
$scope.checkConnection = function() {
if(navigator && navigator.connection && navigator.connection.type === 'none') {alert('no conexion');}
else{alert('conectado');}
};
I call it in index.html like this:
<body ng-app="myApp" ng-controller="checkNetworkController" ng-init="checkConnection()">
When I start the app I get:
Application Error - The connection to the server was unsuccessful. (file:///android_asset/www/index.html)
If I don't call checkConnection everything works fine.
I've tried to reinstall the cordova network plugin and I have added in config.xml:
<preference name="loadUrlTimeoutValue" value="700000" />
But nothing works. Any idea?
Use Cordova plugin add cordova-plugin-network-information Then window.Connection for Checking available internet.
if(window.Connection){
if(navigator.connection.type == Connection.NONE) {
$state.go("error");
alert("offline")
}else{
console.log(navigator.connection.type);
alert("online")
}
}
Finally I got the solution.
I use the same code
if(navigator && navigator.connection && navigator.connection.type === 'none')
{alert('no conexion');}
else{alert('conectado');}
But instead on a function, I include it in the $ionicPlatform.ready(function() at the app.js and now it works.

How to Programatically Check if the Location Services is Turned On or Off in browser using asp.net

i'm developing a website that use geolocation, but nothing happens if i access it with location service disabled. It should show user alert message to enable location service.
What you can do, if geolocation is supported by browser, is check the error code of getCurrentPosition
PERMISSION_DENIED - if the user clicks that “Don’t Share” button or otherwise denies you access to their location.
POSITION_UNAVAILABLE - if the network is down or the positioning satellites can’t be contacted.
TIMEOUT - if the network is up but it takes too long to calculate the user’s position. How long is “too long”? I’ll show you how to
define that in the next section.
if(navigator.geolocation){
navigator.geolocation.getCurrentPosition(
docode, handle_error)
}
function handle_error(err) {
if (err.code == 1) {
// PERMISSION_DENIED
}
else if (err.code == 2) {
// POSITION_UNAVAILABLE
}
else if (err.code == 3) {
// TIMEOUT
}
}

Is there a way to find out if a request was sent using https from a play controller?

I know in older versions, they had the 'secured' field, but that doesn't seem to be there anymore? Is it still possible to find this out? (2.2.1)
According to wikipedia here, there is a de-facto stardard for this kind of information as a HTTP request header. So to obtain this in scala:
val x-forwarded-proto = request.headers("X-FORWARDED-PROTO")
If this value is "https", it's "secured".
In fact you can look up older Play code here (java).
private boolean isRequestSecure() {
Header xForwardedProtoHeader = headers.get("x-forwarded-proto");
Header xForwardedSslHeader = headers.get("x-forwarded-ssl");
// Check the less common "front-end-https" header,
// used apparently only by "Microsoft Internet Security and Acceleration Server"
// and Squid when using Squid as a SSL frontend.
Header frontEndHttpsHeader = headers.get("front-end-https");
return ("https".equals(Play.configuration.get("XForwardedProto")) ||
(xForwardedProtoHeader != null && "https".equals(xForwardedProtoHeader.value())) ||
(xForwardedSslHeader != null && "on".equals(xForwardedSslHeader.value())) ||
(frontEndHttpsHeader != null && "on".equals(frontEndHttpsHeader.value().toLowerCase())));
}
Strangely enough, it's there again on the master branch.

facebook sdk (php) can't get access token

EDITS: See this picture: http://trackauthoritymusic.com/wwwroot/images/fb-issue-bug.jpg.
For snapshots of the Network tab and all HTTPS headers from my page through FB's redirect.
The windows in the image above show the var_dump's in the code below:
For an access token I only get default the combined appId|secret.
When I var_dump $_REQUESTS at the first point of contact from Facebook, I get nothing so know codeigniter is not stripping the values, but i'm definitely not getting an "signed_request" post from Facebook!
I'm 85.1% sure my Facebook app settings are fine. I've made dozens of tweaks and resets while testing to no success.
And when I switch the settings to client-side approach with the access token in the browser hash, i DO get a valid token, but am desperately trying to avoid all that javascript on my page and will need the php integrated anyway.
All of this only happens once you've approved the app, and I can manually look up their membership in Insights, but know they can't access the app without seeing their token.
I had put this bug aside until now, since my ORIGINAL POST below April 24:....
It's been 3 days with trial-n-error and research:
My Environment: LAMP using facebook sdk 3 & CodeIgniter 2
Login Code:
$CI->load->library('facebook', array("appId"=>APP_ID, "secret"=>APP_SECRET));
$this->visitor['access_token'] = $CI->facebook->getAccessToken();
$fb_id = $CI->facebook->getUser();
var_dump($CI->facebook); // see picture above
var_dump($fb_id); // == 0
if ($fb_id && $fb_id > 0) {
$temp = $CI->users->getUserByFb($fb_id);
if (!$temp) {
$this->insertFBUser($fb_id);
$this->visitor['redirect'] = "?prompt=newfb";
} else {
$this->visitor = array_merge($this->visitor, $temp);
if (isset($this->visitor['user_allowed']) && $this->visitor['user_allowed'] == 0) {
$CI->users->updateUser(array("user_allowed" => 1), $this->visitor['user_id']);
}
}
} else {
array_push($this->errors, $CI->input->get_post("error_msg", false));
array_push($this->errors, $CI->input->get_post("error_code", false));
array_push($this->errors, $CI->input->get_post("error_reason", false));
array_push($this->errors, $CI->input->get_post("error", false));
array_push($this->errors, $CI->input->get_post("error_description", false));
if ($CI->input->get_post("autoclose", false) == true) {
array_push($this->errors, "javascript stackoverflow is encoding weird, but basically changes the hashtag of the pop-window, so the parent page automatically closes it");
}
var_dump($this->errors);
die("nada");
}
Research & Debugging:
This post describes my problem as well, but the solution did not work: stackoverflow.com/questions/8587098/suddenly-getuser-became-to-return-0-php-3-1-1-sdk with or without the trailing comma in the DROP_QUERY_PARAMS array on this page.
Facebook is sending me NO error messages in the url, post, or session and scraping my page fine
EVERYTHING worked fine a few days ago and i've changed very little around this code.
The login now fails whether i use http or https
The popup link opens at:
www.facebook.com/dialog/oauth?client_id=222912307731474&redirect_uri=https%3A%2F%2Ftrackauthoritymusic.com%2Fmanage%2Fusers%2Flogin%3Fautoclose%3Dtrue&state=4522cb9da5bf5107d690a22eee6c5a2e&scope=email&display=popup while redirecting successfully to my desired login url with both state and code parameters apparently valid: trackauthoritymusic.com/manage/users/login?autoclose=true&state=4522cb9da5bf5107d690a22eee6c5a2e&code=AQBfSkI4y_VxhCuF3coVvNmjetdGZjugyFv0UsLlKt5sR5MEGdY8KqpDXZKvqHTGaSHhzY4pHXuR_zmilkwmoQ5y6M9jh15GPI6DXz5E2fSBizAVlrlebriNGcNZb4DRaDFK8cxPJoa9xB2ERuimtuizmlZERNa8hwJxLXtztqkWWhkLFCaGjQvAyyf5jJRkuoztmvfKDIZz3W9lslM6fk_m
but at this point, the sdk cannot get any access token or facebook session data.
PLEASE HELP!
I fixed this by using codeigniter's input library within the Facebook SDK to get the code/token and all $_GET/$_POST/$_REQUEST globals.
See the git diff on the facebook sdk. I'm still not sure what i did to break thisthough. OAuth/Login WAS working consistently before a certain point. I'm sure this wasn't just some race condition on codeigniter occasionally clearing the globals
## -490,10 +490,11 ##
*/
public function getSignedRequest() {
if (!$this->signedRequest) {
- if (!empty($_REQUEST['signed_request'])) {
- $this->signedRequest = $this->parseSignedRequest(
- $_REQUEST['signed_request']);
- } elseif (!empty($_COOKIE[$this->getSignedRequestCookieName()])) {
+ $CI = & get_instance();
+ $signed_request = $CI->input->get_post("signed_request");
+ if (!empty($signed_request)) {
+ $this->signedRequest = $this->parseSignedRequest($signed_request);
+ } else if (!empty($_COOKIE[$this->getSignedRequestCookieName()])) {
$this->signedRequest = $this->parseSignedRequest(
$_COOKIE[$this->getSignedRequestCookieName()]);
}
## -691,15 +692,18 ##
protected function getCode() {
- if (isset($_REQUEST['code'])) {
- if ($this->state !== null &&
- isset($_REQUEST['state']) &&
- $this->state === $_REQUEST['state']) {
-
+ $CI = & get_instance();
+ $code = $CI->input->get_post("code");
+ if (!empty($code)) {
+ $state = $CI->input->get_post("state");
+ if ($this->state !== null && $state && $this->state === $state) {
// CSRF state has done its job, so clear it
$this->state = null;
$this->clearPersistentData('state');
- return $_REQUEST['code'];
+ return $code;
} else {
self::errorLog('CSRF state token does not match one provided.');
return false;
$params['access_token'] = $this->getAccessToken();
}

Resources