Hello Anderson,
Yes, ZnetDK includes the capability to limit the access to SQL table rows according to the specified user profiles, through the call to the DAO::setStoredProfiles() and DAO::setProfileCriteria() methods.
When you store a row in a SQL table, you can call first the
DAO::setStoredProfiles() to specify the user profile(s) authorized to access to the table row (these infos are stored in the
zdk_profile_rows table).
$row = array('id'=>18,'name'=>'MARTIN','city'=>'Paris');
$myDao = new \app\model\Customers();
$myDao->setStoredProfiles(array('Buyer'));
$result = $myDao->store($row);
$myDao = new \app\model\Customers();
$myDao->setProfileCriteria(array('Accountant','Manager'));
while($row = $myDao->getResult()) {
$customers[] = $row['id'];
}
if (\controller\Users:hasProfile('Administrator') {
echo 'The connected user is an Administrator';
} else {
echo 'The connected user is not an Administrator';
}
Hoping it will help you
Regards,