Hacker News new | ask | show | jobs
by 04091948 2247 days ago
I personally, would've overridden the equal function of record (or made an equality helper function).

so the code would become

if(!record.isBuiltIn() || !user.canChange(record) || !record.equals(oldRecord)){ // can't save / or no need too }

and if no one can change a builtin, then a user certainly can't change it.

so it becomes:

if( !user.canChange(record || !record.equals(oldRecord))){ // can't save / or no need too }