SimpleSamlphp : add attribut inside another attribut - php

I actualy use simpleSamlPhp for creat an authentification on my website so i have a service provider instal on my website and i also instal an Identity provider until their no problem. My service provider connect to my identity provider and connexion work fine.
I have in the file "config/authsources.php" my different user :
$config = array(
...
'example-userpass' => array(
'userTest:pwd' => array(
'uid' => array('userTest'),
'NameIdentifier' => 'Test',
'Attribut1' => 'att1',
'Attribut2' => 'att2'
)
),
...
),
...
My problem is that i want to have an attribut with several attributs in one attribut for have something like that :
$config = array(
...
'example-userpass' => array(
'userTest:pwd' => array(
'uid' => array('userTest'),
'NameIdentifier' => 'Test',
'Attribut1' => 'att1',
'Attribut2' => array(
'Attribut21' => 'att21',
'Attribut22' => 'att22',
...
)
)
),
...
),
...
But when i do it i have this error :
SimpleSAML_Error_Error: UNHANDLEDEXCEPTION
Backtrace:
1 C:\wamp\www\Idp\simplesamlphp\www\_include.php:37 (SimpleSAML_exception_handler)
0 [builtin] (N/A)
Caused by: Exception: Invalid attributes for user userTest in authentication source example-userpass: Invalid attribute value for attribute Attribut2: array (
'Attribut21' => 'att21',
'Attribut22' => 'att22'
)
So how can i add an attribut with other attribut?

Change
'Attribut21' = 'att21',
'Attribut22' = 'att22',
to
'Attribut21' => 'att21',
'Attribut22' => 'att22',
Since they are supposed to be an associative array.
EDIT: ok, not sure what's the problem here... i'm gonna post an example and hopefully you do understand the pattern. (each array is in fact more attributes)
<?php
$config = array(
'example-userpass' => array(
'exampleauth:UserPass',
'student:studentpass' => array(
'uid' => array('student'),
'eduPersonAffiliation' => array('member', 'student'),
),
'employee:employeepass' => array(
'uid' => array('employee'),
'eduPersonAffiliation' => array('member', 'employee'),
),
),
);

It was not really diffcult finally i just have to do :
$config = array(
...
'example-userpass' => array(
'userTest:pwd' => array(
'uid' => array('userTest'),
'NameIdentifier' => 'Test',
'Attribut1' => 'att1',
'Attribut2' => array(
'att21',
'att22',
...
)
)
),
...
),
...

Related

Problem while adding Journal Entry with customer in Quickbook - Message: Passed array has no key for 'Value' when contructing an ReferenceType

I go through this documentation "https://developer.intuit.com/app/developer/qbo/docs/api/accounting/all-entities/journalentry"
And tried to add journal entry with line having customer as shown in the below code:
$journal_entry_create['TxnDate'] = date('Y-m-d');
$journal_entry_line = array(
'Amount' => $amount,
'DetailType' => 'JournalEntryLineDetail',
'JournalEntryLineDetail' => array(
'PostingType' => Credit,
'Entity' => array(
'Type' => 'Customer',
'EntityRef' => array(
'type' => 'Customer',
'value' => "2",
'name' => 'Abc'
)
),
'AccountRef' => array(
'name' => 'Account Name',
'value' => '1'
),
)
);
$journal_entry_lines[] = $journal_entry_line;
$journal_entry_create['Line'] = $journal_entry_lines;
$journal_entry_receipt_create = QBJournalEntry::create($journal_entry_create);
$journal_entry_receipt_create_result = $dataService->Add($journal_entry_receipt_create);
Without EntityRef its working fine but when I add EntityRef its giving me error "Message: Passed array has no key for 'Value' when contructing an ReferenceType"
Only just came across this problem myself. They did fix this issue but didn't seem to document it at all or tell anyone. Found the fix in the source code. You need to use "JournalEntryEntity" instead of "Entity" under "JournalEntryLineDetail", like so:
'JournalEntryLineDetail' => array(
'PostingType' => "Credit",
'JournalEntryEntity' => array(
'Type' => 'Customer',
'EntityRef' => array(
'value' => "2"
)
),
'AccountRef' => array(
'name' => 'Account Name',
'value' => '1'
),
)
Also I used the FacadeHelper from the V3 of the PHP SDK (I'm not sure if it'll work with the method you were using):
use QuickBooksOnline\API\Facades\FacadeHelper;
...
$journal_entry_receipt_create = FacadeHelper::reflectArrayToObject('JournalEntry', $journal_entry_create);
$journal_entry_receipt_create_result = $dataService->Add($journal_entry_receipt_create);
I know this is probably too late for you OP but hopefully it helps someone else!

aws SDK 3, PHP, runInstance does not create the supplied Tags

$options = array(
'UserData' => base64_encode('test'),
'SecurityGroupIds' => [AWS_REGIONS[$region]['security_group']],
'InstanceType' => AWS_REGIONS[$region]['instance_type'],
'ImageId' => AWS_REGIONS[$region]['ami'],
'MaxCount' => $to_launch,
'MinCount' => 1,
//'EbsOptimized' => true,
'SubnetId' => AWS_REGIONS[$region]['subnet_id'],
'Tags' => [['Key' => 'task', 'Value' => $task],['Key' => 'Name', 'Value' => $task]],
'InstanceInitiatedShutdownBehavior' => 'terminate'
);
$response = $client->runInstances($options);
I am using the "latest" Ec2Client
It launches fine but the Tags are completely ignored.
I suspect an error within the EC2 API but I am not that experienced.
Maybe someone with experience can help me out ?
This is because Ec2Client::runInstances does not have tags option
http://docs.aws.amazon.com/aws-sdk-php/v3/api/api-ec2-2015-10-01.html#runinstances
You would need to make a separate call to tag newly created instance(s) using Ec2Client::createTags:
$result = $client->createTags(array(
'DryRun' => true || false,
// Resources is required
'Resources' => array('string', ... ),
// Tags is required
'Tags' => array(
array(
'Key' => 'string',
'Value' => 'string',
),
// ... repeated
),
));
Read more here:
http://docs.aws.amazon.com/aws-sdk-php/v3/api/api-ec2-2015-10-01.html#createtags

SugarCRM On-Demand Convert TextField to DropDown

A similar question was posted here before but it only applied to an On-Site SugarCRM instance (it was also a long time ago).
In my case I would like to change the "Billing Country" field from 'TextField' to 'DropDdown' on an On-Demand instance where I don't have access to the config files. How can I do this?
So far I have tried different PHP files using the Module Loader but it's not working either.
Please find my PHP script below:
<?php
$manifest = array(
'acceptable_sugar_flavors' => array('CE', 'PRO', 'CORP', 'ENT', 'ULT'),
'acceptable_sugar_versions' => array(
'exact_matches' => array(),
'regex_matches' => array(
0 => '6\\.5\\.(.*?)',
1 => '6\\.7\\.(.*?)',
2 => '7\\.2\\.(.*?)',
3 => '7\\.2\\.(.*?)\\.(.*?)',
4 => '7\\.5\\.(.*?)\\.(.*?)',
5 => '7\\.6\\.(.*?)\\.(.*?)'
),
),
'name' => 'Textfield to Dropdown',
'description' => 'Converting Billing Country textfield to Dropdown Field',
'author' => 'myname',
'icon' => '',
'is_uninstallable' => true,
'published_date' => '2015-01-09 19:00:00',
'type' => 'module',
'version' => '1.0',
);
$dictionary['Account']['fields']['billing_address_country']['type'] = 'enum';
$dictionary['Account']['fields']['billing_address_country']['ext1'] = 'countries_dom';
The module loads fine but there's no change after a Quick Repair. I have tried with the following variables, as well:
$dictionary['Account']['fields']['billing_address_country']['isDropDown']=yes;
and...
$dictionary['Account']['fields']['billing_address_country']['Options']='countries_dom';
Can anyone tell me what I am doing wrong? I'd appreciate any help or guidance you have. Please advise.
Cheers,
H
P.S. I am using SugarCRM On-Demand Version 7.6.1
You need to create the manifest.php file and have that point to the file(s) you want to copy/upload for customization:
manifest.php:
<?php
$manifest = array(
'built_in_version' => '7.6.1.0',
'acceptable_sugar_versions' =>
array(
0 => '',
),
'acceptable_sugar_flavors' =>
array(
0 => 'PRO',
1 => 'CORP',
2 => 'ENT',
3 => 'ULT',
),
'readme' => '',
'key' => 'SO',
'author' => 'Eric',
'description' => 'Convert Accounts Billing Country TextField to Enum',
'icon' => '',
'is_uninstallable' => true,
'name' => 'TextFieldToDropdownPkg',
'published_date' => '2016-01-10 03:01:01',
'type' => 'module',
'version' => 1452378413,
'remove_tables' => 'prompt',
);
$installdefs = array(
'id' => 'TextFieldToDropdownPkg',
'copy' => array(
0 => array(
'from' => '<basepath>/custom/Extension/modules/Accounts/Ext/Vardefs/custom_billing_address_country.php',
'to' => 'custom/Extension/modules/Accounts/Ext/Vardefs/custom_billing_address_country.php',
),
),
);
Then create:
custom/Extension/modules/Accounts/Ext/Vardefs/custom_billing_address_country.php
<?php
$dictionary['Account']['fields']['billing_address_country']['comments']='Country for primary address';
$dictionary['Account']['fields']['billing_address_country']['group']='primary_address';
$dictionary['Account']['fields']['billing_address_country']['options']='countries_dom';
$dictionary['Account']['fields']['billing_address_country']['type']='enum';
ZIP those files up and use Module Loader.

aws sdk validation error must be type object

I'm trying to create a record set with the aws sdk and I'm getting this validation error:
Validation errors: [ChangeBatch][Changes][0][Change][ResourceRecordSet][ResourceRecords][Value][ResourceRecord] must be of type object
My code looks like this:
$result = $r53->changeResourceRecordSets(array(
'HostedZoneId' => 'XXXXXXXXXXXXXXX',
'ChangeBatch' => array(
'Changes' => array(
array(
'Action' => 'CREATE',
'ResourceRecordSet' => array(
'Name' => 'psion',
'Type' => 'CNAME',
'ResourceRecords' => array(
'Value' => 'example.com'
),
),
'Change' => array(
'ResourceRecordSet' => array(
'ResourceRecords' => array(
'Value' => array(
'ResourceRecord' => $aws->get('Route53'),
),
),
),
),
),
),
),
));
Any idea what the validation error means?
Validation errors: [ChangeBatch][Changes][0][Change][ResourceRecordSet][ResourceRecords][Value][ResourceRecord] must be of type object.
By type "object", it means an associative array. This is a validation message bubbling up from the Guzzle layer.
Here are the API docs for Route53Client::changeResourceRecordSets(), which shows an example of how the request should look when it is formatted correctly.
That whole array you have under the 'Change' key is not correct at all.

ZfcUser setup issue

I am trying to setup ZfcUser as described in README.md on the github page.
I understand all but this step in Post-Install: Zend\Db;
2. Now, specify the DI alias for your PDO connection in ./configs/autoload/module.zfcuser.config.php, under the 'pdo' setting. If you created the ./config/autoload/database.config.php file in the previous step, the alias you'll specify is 'masterdb'.
Can anyone describe me what exactly to do?
Thanks very much.
Manage to fix this by updating the parameter name in module.config.php for ZfcUser. Corrected from
'zfcuser_user_tg' => array(
'parameters' => array(
'table' => 'user',
'adapter' => 'zfcuser_zend_db_adapter',
),
),
'zfcuser_usermeta_tg' => array(
'parameters' => array(
'table' => 'user_meta',
'adapter' => 'zfcuser_zend_db_adapter',
),
),
to
'zfcuser_user_tg' => array(
'parameters' => array(
'tableName' => 'user',
'adapter' => 'zfcuser_zend_db_adapter',
),
),
'zfcuser_usermeta_tg' => array(
'parameters' => array(
'tableName' => 'user_meta',
'adapter' => 'zfcuser_zend_db_adapter',
),
),
table => corrected to tableName
I had the same problem. The solution was to uncomment line 15 in module.zfcuser.config.php and not use the 'masterdb' ...
'zend_db_adapter' => 'Zend\Db\Adapter\Adapter',
See support issue ...
https://github.com/ZF-Commons/ZfcUser/issues/42

Categories