How do people manage permissions between their code base and the database? For example, my application is becoming littered with:
if($objects['username']['access_type'] == 'edit'){
// print the HTML to edit the username
}
or in OO:
if($user->getPermission('username')->canEdit()){
// print the HTML to edit the username
}
How do you keep track of where the object 'username'
and the permission 'edit'
are used and how do you maintain the link between these hard-coded permission 'tags' and their relevant entries in the permissions table in the database? Surely from time to time, some of these must get lost, renamed or misused? Any thoughts?