Permissions of user 'kirby'

I have a page setup where the user should not be able to edit the names of image-files, my blueprint looks like this:


title: Artist Image
accept: image/png, image/jpeg, image/gif

  changeName: false

However, when the user uploads a file i want to move it to a different directory and rename it in a hook. i am impersonating as ‘kirby’ to override the permissions of the blueprint:

'file.create:after' => function($file) {
      // bail out if not a virtual-page
      if(!method_exists($file->parent(), 'isVirtualPage')) return true;
      $fileSlug = $file->parent()->intendedTemplate() . '_' . $file->parent()->slug();
      // add page-slug to filename for retrieval
      kirby()->impersonate('kirby', function () use($file, $fileSlug) {
        $newFile = $file->changeName($fileSlug . VP_FILENAME_DELIMITER . $file->name() , false);
        // copy uploaded file to media-page

      // delete unused directory that was created during upload
      $dir = realpath($file->parent()->root());
      if (is_dir($dir) && Dir::isEmpty($dir)) {

However i keep getting the “You are not allowed to change the name of XYZ.jpeg”-Error.

Is the the xpected behaviour? My thinking was that the ‘kirby’-user has no restrictions whatsoever?

If you generally disallow that option, you won’t be able to override it with any user. You can, however, set those options per user role:

ok, just tried that and it works! thx!