Implementing permission command.
Fixed bug in perms API.