Added method setPermission.
Implemented database save.