Guite/MostGenerator — Issue #160: Creation of entities by guests gives error
Author: espaan
Created: 2012-02-26 00:12:09+00:00
State: open

Hi,
I have enabled creation of an entity to guests by allowing Module:Entity: :: EDIT access. This works
in principle.

I have edited the Module/Controller/User.php edit function
```
if ($objectType == 'inschrijving') {
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Wedstrijden:Inschrijving:', '::', ACCESS_EDIT));
} else {
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Wedstrijden::', '::', ACCESS_EDIT));
}
```
Here it might be better to also use the objecttypeCapital like being used in other functions in the perm. check.

When I correct the pem. check stuff I run into
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'createdUserId' cannot be null

Error listing:
```
#5 .../modules/Wedstrijden/lib/Wedstrijden/Form/Handler/User/Inschrijving/Base/Edit.php(212): Doctrine\ORM\EntityManager->flush()
#6 .../modules/Wedstrijden/lib/Wedstrijden/Form/Handler/User/Base/Edit.php(490): Wedstrijden_Form_Handler_User_Inschrijving_Base_Edit->performUpdate(Array)
#7 .../modules/Wedstrijden/lib/Wedstrijden/Form/Handler/User/Inschrijving/Base/Edit.php(141): Wedstrijden_Form_Handler_User_Base_Edit->HandleCommand(Object(Zikula_Form_View), Array)
```
So the userid is not 1 for anonymous but apparently 0 or not filled in.