Add permissions support in Stats templates