private function createRegistrationRole($withUserRegisterPolicy = true)
    {
        $roleIdentifier = uniqid(
            'anonymous_role_' . ($withUserRegisterPolicy ? 'with' : 'without') . '_register',
            true
        );

        $roleService = $this->getRepository()->getRoleService();
        $roleCreateStruct = new RoleCreateStruct(['identifier' => $roleIdentifier]);

        $policiesSet = explode(',', EzEnvironmentConstants::get('CREATE_REGISTRATION_ROLE_POLICIES'));
        foreach ($policiesSet as $policy) {
            [$module, $function] = explode('/', $policy);
            $roleCreateStruct->addPolicy($roleService->newPolicyCreateStruct($module, $function));
        }

        if ($withUserRegisterPolicy === true) {
            $roleCreateStruct->addPolicy($roleService->newPolicyCreateStruct('user', 'register'));
        }

        $roleService->publishRoleDraft($roleService->createRole($roleCreateStruct));

        return $roleService->loadRoleByIdentifier($roleIdentifier);
    }
private function createRegistrationRole($withUserRegisterPolicy = true)
    {
        $roleIdentifier = uniqid(
            'anonymous_role_' . ($withUserRegisterPolicy ? 'with' : 'without') . '_register',
            true
        );

        $roleService = $this->getRepository()->getRoleService();
        $roleCreateStruct = new RoleCreateStruct(['identifier' => $roleIdentifier]);

        $policiesSet = explode(',', EzEnvironmentConstants::get('CREATE_REGISTRATION_ROLE_POLICIES'));
        foreach ($policiesSet as $policy) {
            [$module, $function] = explode('/', $policy);
            $roleCreateStruct->addPolicy($roleService->newPolicyCreateStruct($module, $function));
        }

        if ($withUserRegisterPolicy === true) {
            $roleCreateStruct->addPolicy($roleService->newPolicyCreateStruct('user', 'register'));
        }

        $roleService->publishRoleDraft($roleService->createRole($roleCreateStruct));

        return $roleService->loadRoleByIdentifier($roleIdentifier);
    }
private function createRegistrationRole ( $ withUserRegisterPolicy = true ) { $ roleIdentifier = uniqid ( 'anonymous_role_' . ( $ withUserRegisterPolicy ? 'with' : 'without' ) . '_register' , true ) ; $ roleService = $ this -> getRepository ( ) -> getRoleService ( ) ; $ roleCreateStruct = new RoleCreateStruct ( [ 'identifier' => $ roleIdentifier ] ) ; $ policiesSet = explode ( ',' , EzEnvironmentConstants :: get ( 'CREATE_REGISTRATION_ROLE_POLICIES' ) ) ; foreach ( $ policiesSet as $ policy ) { [ $ module , $ function ] = explode ( '/' , $ policy ) ; $ roleCreateStruct -> addPolicy ( $ roleService -> newPolicyCreateStruct ( $ module , $ function ) ) ; } if ( $ withUserRegisterPolicy === true ) { $ roleCreateStruct -> addPolicy ( $ roleService -> newPolicyCreateStruct ( 'user' , 'register' ) ) ; } $ roleService -> publishRoleDraft ( $ roleService -> createRole ( $ roleCreateStruct ) ) ; return $ roleService -> loadRoleByIdentifier ( $ roleIdentifier ) ; }
Creates a role for user registration test.

It always has the minimal set of policies to operate (user/login and content/read).

@param bool $withUserRegisterPolicy Determines if the role gets the user/register policy

@return Role
Creates a role for user registration test .