Programmatically remove guest permissions for file
Permalink
Hi all,
I'm running an event which should remove guest users' viewing permissions to the specified file ($f). The below code, when the event is run, is removing guest view permissions from files globally, not just for the file passed in.
Anyone with greater experience/knowledge of programming file permissions would be greatly appreciated - I feel like I've searched everywhere.
Many thanks!
I'm running an event which should remove guest users' viewing permissions to the specified file ($f). The below code, when the event is run, is removing guest view permissions from files globally, not just for the file passed in.
$pk = PermissionKey::getByHandle('view_file'); $pk->setPermissionObject($f); $pa = $pk->getPermissionAccessObject(); $pe = GroupPermissionAccessEntity::getOrCreate(UserGroup::getByID(GUEST_GROUP_ID)); $pa->removeListItem($pe);
Anyone with greater experience/knowledge of programming file permissions would be greatly appreciated - I feel like I've searched everywhere.
Many thanks!