code: public static boolean hasPermission(final String permission) {
          final SecurityContext context = SecurityContextHolder.getContext();
          if (context != null) {
              final Authentication authentication = context.getAuthentication();
              if (authentication != null) {
                  for (final GrantedAuthority authority : authentication.getAuthorities()) {
                      if (authority.getAuthority().equals(permission)) {
                          return true;
                      }
                  }
              }
          }
          return false;
      }
docs: Checks the current {@link SecurityContext} for the permission.
  
  @param permission
  the permission to check against the security context
  @return {@code true} if the given permission is present in the security
  context otherwise {@code false}