diff --git a/app/Controller/CoPeopleController.php b/app/Controller/CoPeopleController.php index af63feb24..2746aa727 100644 --- a/app/Controller/CoPeopleController.php +++ b/app/Controller/CoPeopleController.php @@ -784,6 +784,11 @@ public function isAuthorized() { else $p['cous'] = array(); + + // CO-1650: only allow adding email addresses if there are any types set as self-serviceable + $email_address_types = $this->CoPerson->EmailAddress->defaultTypes('type'); + $p['add_emailaddress'] = $p['edit'] && sizeof($email_address_types) > 0; + $this->set('permissions', $p); return $p[$this->action]; } diff --git a/app/View/CoPeople/fields.inc b/app/View/CoPeople/fields.inc index d3ef9c3bc..1d6a0e911 100644 --- a/app/View/CoPeople/fields.inc +++ b/app/View/CoPeople/fields.inc @@ -617,7 +617,7 @@ print $this->element('mvpa', $args); - $args['edit'] = $e; + $args['edit'] = $e && $permissions['add_emailaddress']; $args['self_service'] = true; $args['mvpa_model'] = 'EmailAddress'; $args['mvpa_field'] = 'mail';