Adding testing case and permission checking