Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This code was added between the $schema and $form definitions. Also corrected typo on $cutomsFields to $customFields
- foreach($schema->all() as $key => $cfs) {
- // key = field name
- // $cfs = field schema
- if(isset($cfs['permission'])) {
- $vperm = isset($cfs['permission']['view'])?$cfs['permission']['view']:'uri_user';
- $eperm = isset($cfs['permission']['edit'])?$cfs['permission']['edit']:'uri_user';
- if($customProfile->has($key)) {
- if(!$authorizer->checkAccess($currentUser, $vperm, ['user' => $user])) {
- $customProfile->offsetUnset($key);
- $schema->offsetUnset($key);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement