Hello Passbolt Support Team,
I am implementing a feature in my self-hosted Passbolt installation to automatically share newly created passwords with the admin group. I’ve added logic in ResourceAddController.php
to facilitate this, but I am not sure how to generating a valid secret key for each user in the admin group.
Here’s a sample code snippet I’ve created:
$uac = $this->User->getAccessControl();
$groupId = ‘’; // This is the group ID of the admin group
$accessType = 15; // This is the Is Owner Permission ID
$resourceId = ‘’; // This is the ID of the new resource to share
$permissions = [[
‘aco’ => ‘Resource’,
‘aro’ => ‘Group’,
‘aco_foreign_key’ => $resourceId,
‘aro_foreign_key’ => $groupId,
‘type’ => $accessType
]];
$groupsUsers = $this->fetchTable(‘GroupsUsers’);
$groupsUsersIds = $groupsUsers->findByGroupId($groupId)
->all()
->extract(‘user_id’)
->toArray();
$secrets = ;
foreach ($groupsUsersIds as $groupUserId) {
$secrets = [
‘resource_id’ => $resourceId,
‘user_id’ => $groupUserId->id,
‘data’ => // Here is the issue
];
}
$resourcesShareService->share($uac, $resourceId, $permissions, $secrets);
The challenge I face is generating a valid secret key for each user in the admin group. I would appreciate any guidance on how to achieve this within the controller.
Thank you for your assistance!