Permission check

Added a permission check that probably works right.