6 ms·
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
by 04091948 6y 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
}