grantRight
kidandcat opened this issue · comments
Could I get an example of grantRight?, I can't see how to use it:
$createAccountRight = new RightModifierInfo('createAccount');
$grantee = new GranteeSelector(accountIdByName('testuser'));
$type = new TargetType('domain');
$target = new EffectiveRightsTargetSelector($type, 'zimbra-1.telcom');
$api->grantRight($target, $grantee, $createAccountRight);
new TargetType does not have construct, so extended Base constructor is protected and it gives an error.
Ok, got it:
$createAccountRight = new RightModifierInfo ( 'createAccount' );
$grantee = new GranteeSelector ();
$granteeType = new GranteeType ();
$granteeType->value ( 'testuser' );
$grantee->setBy ( $granteeType );
$type = new TargetType ( 'domain' );
$targetby = new TargetBy ( 'name' );
$targetby->value ( 'zimbra-1.telcom' );
$target = new EffectiveRightsTargetSelector ( $type, $targetby );
$api->grantRight ( $target, $grantee, $createAccountRight );