You are here

public function FppFileAccessTest::makeFppObjectPrivate in Fieldable Panels Panes (FPP) 7

Update an FPP object so that it is make only accessible by admins.

Parameters

object $fpp: An FPP object to be made private.

int $rid: The role to be added to the object; defaults to 2 (authenticated user).

Return value

object The FPP object with updated access rules.

2 calls to FppFileAccessTest::makeFppObjectPrivate()
FppFileAccessTest::testFileAccessWithCorrectAuth in tests/fpp.file_access.test
Confirm private file access works when the visitor DOES have access.
FppFileAccessTest::testFileAccessWithIncorrectAuth in tests/fpp.file_access.test
Confirm private file access works when the visitor does NOT have access.

File

tests/fpp.file_access.test, line 215
Tests for the Fieldable Panels Panes module to ensure file access works.

Class

FppFileAccessTest
Tests for the Fieldable Panels Panes module to ensure file access works.

Code

public function makeFppObjectPrivate($fpp, $rid = 2) {
  $fpp->view_access = array(
    'plugins' => array(
      array(
        'name' => 'role',
        'settings' => array(
          'rids' => array(
            $rid,
          ),
        ),
        'context' => 'logged-in-user',
        'not' => FALSE,
      ),
    ),
    'logic' => 'and',
  );
  fieldable_panels_panes_save($fpp);
  $saved_fpp = fieldable_panels_panes_load($fpp->fpid);
  return $saved_fpp;
}