added permission checking and tests