Fixed permissions routine and $text

Permission hook sub-routine adjustment.
Fixed missing wildcard in permissions $text