Access objects from project in sandbox environment PHP - rally

Is there a way I can access my project under Sandbox? I'm able to use the lookup method, find in order to fetch all the features from a project under the Yahoo! subscription, but how would I be able to do this for projects under Sandbox?

In your PHP code have you used Rally sandbox server URL?
https://sandbox.rallydev.com/
Here is a WebServices URL specific to Sandbox:
https://sandbox.rallydev.com/slm/doc/webservice/

I was able to figure it out. In the query to find specific features, I had to include the query parameter "workspace" to the sandbox reference which is (for 1.43) : "https://rally1.rallydev.com/slm/webservice/1.43/workspace/7189290105.js". I included the reference of the project as well which directly fetched all the features for my project. In addition, if you seek to only fetch features from your specific project and not from the ones on top of it, you have to include the "pageScopeUp" field into the query. You have to set this field to false:
$queryParams = array(
'query' => "",
'fetch' => 'true',
'pagesize' => 100,
'start' => 1,
'workspace' => "https://rally1.rallydev.com/slm/webservice/1.43/workspace/7189290105.js",
'project' => "whatever the project reference is",
'projectScopeUp' => false
);
$results = Connection::rally()->findWithQueryParameters('feature',
$queryParams);

Related

How to make a field required for customers but not for administrators in prestashop?

I made a custom field in prestashop.
I would like to know if there is some way to make this field only required on the frontend and not for administrators.
this is my code in Customer class
array('type' => self::TYPE_STRING, 'required' => true, 'size' => 64),
Thanks in advance
Can't think of a quick way to make this possible exactly as you want it, so here are two suggestions:
1 - Remove the 'required' => true from the definition and create some kind of custom validation like if (Tools::getValue('type ') == "") { return false; } in an override of the front office AuthController (Warning: code is completely untested and should definitely be improved, also according to your particular PS version).
2 - Use frontend validation by giving the frontend form field the required attribute (you should do this even if oyu use 1)

get some of my controllers in zend framework 2

I am createing a cms based on zend framework 2 . I have som modules , let's say News module.
It has two controllers one for backend and one for front page :
News Module :
-- AdminController
-- IndexController
My question is How can I list all AdminControllers in my admin module ?
I think it can be achieved by event manager but I don't know how
Thanks in advance
Your Admin module does this:
check a config key (i.e. super_cms)
check if a subkey exists (i.e. controllers)
foreach entries in said subkey, list them on your webpage
Your News module does this:
//module.config.php
return [
'super_cms' => [
'controllers' => [
'NewsModule\Controller\AdminController' => [
'label' => 'News',
'permission' => 'Admin',
'route' => 'news/admin'
]
]
]
];
Now with this setup, you could do a foreach on the controllers and create a navigation that has all your controllers listed that you need. You could specify dedicated label options, you could assign permission keys that are required for access or you could assign a dedicated route to call.
This is all up to you tho. But without configuration, nothing works. There are "magic" ways, yes, but they would all require you to recursively scan lots and lots of directories which you don't want! Seriously, you don't!

CheckAccess. Agile Web Application Development with Yii1.1

I need some help with CheckAccess function.
I'm reading book Agile Web Application Development with Yii1.1 and PHP5, and came to page 212. On this page I've to added a "Create user" menu item.
I login with the user that is associated with the project (in Db table project_user_role) like a member, and members has operateion called 'createUser'.
The problem is that I can't see the menu item which should be generated by the following code:
if (Yii::app()->user->checkAccess('createUser', array('project' => $model))) {
$this->menu[] = array('label' => 'Add User To Project', 'url' => array('adduser', 'id' => $model->id));
}
Thanks
Also with AuthAssignment there are two more tables and even having them is not full deal. You got to have set RBAC :).
Please SeeRole-Based Access Control

How to create configurable product using magento api?

How can I create a configurable product using the Magento api?
Your question of creating a configurable product using the API - the answer is: You can't. It doesn't support it (yet at least.)
This is possible with the magento-improve-api plugin. If you need to control which attributes your configurable product is configurable across, you'll need one of the forks of that plugin in
goodscloud/magento-improve-api
jdurand/magento-improve-api
dexteradeus/magento-improve-api
Here's a really good tutorial that walks you through patching the API, so you can use the API directly to create the configurable product, and assign simple products to it as well.
Good luck
Copy/pasted from http://www.magentocommerce.com/wiki/doc/webservices-api/api/catalog_product#example_2._product_createviewupdatedelete
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');
// default attribute set in my install is 4
$attribute_set_id = 4;
// configurable product to create
$product_sku = 123456789012;
$newProductData = array(
'name' => 'name of product',
// websites - Array of website ids to which you want to assign a new product
'websites' => array(1), // array(1,2,3,...)
'short_description' => 'short description',
'description' => 'description',
'price' => 12.05
);
$proxy->call($sessionId, 'product.create', array(
'configurable',
$attribute_set_id,
$product_sku,
$newProductData
));
The hard part is assigning simple products to your configurables (not supported via the api). Here's a method for assigning simples to configurables directly

Is it possible to set certain product attributes for a different store view using the Magento API?

We are currently using the Magento API for importing a bunch of products into the store.
But we now run into a problem where some product attributes should be translated into a different language.
And I was wondering if it is possible to do this using the Magento API, because I can't seem to find anything related to that problem.
We currently have 2 store views, 1 for the Dutch version of the site and one for the French version of the site.
Our current import code looks something like this:
$store_id = $soapClient->call($soapSession, 'catalog_product.currentStore', array('nl'));
echo("store_id: $store_id");
$new_product_data = array(
'name' => 'NameInDutch',
'short_description' => 'DescriptionInDutch',
'price' => $price,
'weight' => $weight,
'websites' => array('base'),
'status' => '1'
);
$new_product_id = $soapClient->call($soapSession, 'catalog_product.create', array('simple', 4, $sku, $new_product_data)); // 4 => 'Default' attribute set
$localized_product_data = array(
'name' => 'NameInFrench',
'short_description' => 'DescriptionInFrench'
);
$store_id = $soapClient->call($soapSession, 'catalog_product.currentStore', array('fr'));
echo("store_id: $store_id");
$soapClient->call($soapSession, 'catalog_product.update', array($sku, $localized_product_data ));
Now, the output of the echo statements differs, the first time it's 1 and the second time it's 2, so that doesn't seem to be problem. But apparently it doesn't matter for the API if we set that value.
The result is that on the 'catalog_product.update' call, the name 'NameInFrench' overwrites the default name 'NameInDutch'.
So my question is if something like this is possible using the Magento API, and how one would accomplish this?
Ok, I found the answer, apparently I overlooked a certain line in the Magento API docs, because the solution was right there.
So: you don't need to set the currentStore each time, you just need to append the store id or code to the update array:
$soapClient->call(
$soapSession,
'catalog_product.update',
array($sku, $localized_product_data, 'fr')
);
This works perfectly.