Permission Check

Added permission check logic