protected function doSave()
 {
     $context = Context::getInstance();
     $role = $this->checkAccess($context->user);
     if ($role <= Acl::READER) {
         throw new PermissionDenied("No permission to create");
     }
     $this->permissions = json_encode($this->permissions);
     parent::doSave();
 }
 protected function doSave()
 {
     $this->encodePassword();
     parent::doSave();
 }