package hello.beans;

import leap.lang.params.Params;
import leap.orm.sql.SqlContext;
import leap.orm.sql.SqlTag;
import leap.orm.sql.SqlTagProcessor;

public class SecurityQueryFilter implements SqlTagProcessor {

    @Override
    public String processTag(SqlContext context, SqlTag tag, Params params) {
        String entityName = tag.getContent();

        if(entityName.equals("User")) {
            return "t.id = #{env.user.id}";
        }

        return null;
    }

}

@@ -47,16 +47,41 @@
 Params;%0A
+import leap.orm.sql.Sql;%0A
 import l
@@ -295,16 +295,25 @@
 context,
+ Sql sql,
  SqlTag 

update SecurityQueryFilter