security - Usage of myBoolean = !myBoolean -
i've seen kind of statement few times in java code. example when wanting set button not visible in vaadin framework (or equivalent):
boolean access = authorizator.isadmin(); access = !access; savebutton.setvisible(access);
why not this:
boolean access = authorizator.isadmin(); if(!access) { savebutton.setvisible(false); }
your second example not same. sets button invisible, never sets visible. cleanest (imho) , functionally equal first be
savebutton.setvisible(!authorizer.isadmin());
Comments
Post a Comment