simplify check user security
remove useless if
scrutinizer optimization