title: How to interpret hasPermission in spring security?
body: <p>I am new to spring security. How do I interpret this?</p>
  
  <pre><code> @PreAuthorize("hasPermission(null, 'opetussuunnitelma', 'LUONTI')")
       OpetussuunnitelmaDto addOpetussuunnitelma(OpetussuunnitelmaDto opetussuunnitelmaDto);
  </code></pre>
  
  <p>Which method from the permission evaluator would get called? I think the one with three parameters would get called in this case. It is checking if the current user has the 'LUONTI' permission on the target of type - 'opetussuunnitelma' . Am I right? Can't we just not include "null" and pass only two parameters. I read that the first argument ( the Authentication object) is not supplied.</p>
  
  <pre><code>+public class PermissionEvaluator implements org.springframework.security.access.PermissionEvaluator {
  +
  +    @Override
  +    public boolean hasPermission(Authentication authentication, Object targetDomainObject, Object permission) {
  +        LOG.error(" *** ei toteutettu *** ");
  +        return true;
  +    }
  +
  +    @Override
  +    public boolean hasPermission(Authentication authentication, Serializable targetId, String targetType, Object permission) {
  +        LOG.error(" *** ei toteutettu *** ");
  +        return true;
  +    }
  +
  +    private static final Logger LOG = LoggerFactory.getLogger(PermissionEvaluator.class);
  +}
  </code></pre>