public function addGroupPermission($groupId, $permission, $update = true)
{
if (empty($groupId)) {
return;
}
if ($this->get('type') == 'matrix' && isset($this->data['groups'][$groupId])) {
$this->data['groups'][$groupId] |= $permission;
} else {
$this->data['groups'][$groupId] = $permission;
}
if ($update) {
$this->save();
}
}