Bakery populates the database field users.init with an account edit URL. There are several problems with this.
It creates a maintenance overhead in case the URL on the master changes, and/or in case the application is cross-platform.
The URL is transmitted as useless baggage in the cookie. The php code has to strip the URL from the content in order to access the only value that really matters - the user ID in the master.
For some reason the field users.init has an additional purpose: To detect whether a user is Bakery enabled.
It would be useful to have an additional database field for this - cheap in comparison with the waste otherwise.
If this cannot be sorted, then one could implement a format for users.init:
"bakery_master_uid_"${uid} e.g. "bakery_master_uid_9999" and have function that extract the two values from the field e.g.
/**
* Detect whether a user is bakery enabled.
*/
function bakery_is_user_bakery_enabled($init) {
return (substr($init, 0, 18) == 'bakery_master_uid_');
}
The account edit URL can then be kept in the PHP code, the "init" field in the cookie can be renamed to "uid" while containing only the primary key.
Comments
Comment #1
coltraneI hear you, Bakery is complicated beyond necessary.
This may be appropriate for a 3.x branch. Postponing for now.
#1338004: Do not store master protocol in init to better support mixed SSL domains is somewhat related.
Comment #2
purencool commentedComment #3
avpadernoComment #4
avpaderno