8.4+: How to set group permission to Add Files
Permalink
Referring to this:https://documentation.concrete5.org/developers/permissions-access-se...
I need to programmatically set permissions to a group of users to add files to the file manager. The following throws an error: "Call to a member function addListItem() on null"
What am I missing?
Do I also have to assign file replace/edit/delete permissions to enable user to replace files?
Thank you.
I need to programmatically set permissions to a group of users to add files to the file manager. The following throws an error: "Call to a member function addListItem() on null"
use Concrete\Core\User\Group\Group; use Concrete\Core\Permission\Key\Key as PermissionKey; use Concrete\Core\Permission\Access\Entity\GroupEntity; $group = Group::getByName('VIPs'); $pk = PermissionKey::getByHandle('add_file'); $pa = $pk->getPermissionAccessObject(); if (is_object($group)) { $pae = GroupEntity::getOrCreate($group); $pa->addListItem($pae, false, PermissionKey::ACCESS_TYPE_INCLUDE); } $pa->markAsInUse();
What am I missing?
Do I also have to assign file replace/edit/delete permissions to enable user to replace files?
Thank you.