Comment Comment by 04091948 I personally, would've overridden the equal function of record (or made an equality helper function).so the code would becomeif(!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 } parent 04091948 6 years ago
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 }