/** * Assigns role to user with given limitation. * * @param mixed $contentId * @param mixed $roleId * @param array $limitation */ public function assignRole($contentId, $roleId, array $limitation) { try { return $this->innerGateway->assignRole($contentId, $roleId, $limitation); } catch (DBALException $e) { throw new RuntimeException('Database error', 0, $e); } catch (PDOException $e) { throw new RuntimeException('Database error', 0, $e); } }
/** * Assigns role to a user or user group with given limitations. * * The limitation array looks like: * <code> * array( * 'Subtree' => array( * '/1/2/', * '/1/4/', * ), * 'Foo' => array( 'Bar' ), * … * ) * </code> * * Where the keys are the limitation identifiers, and the respective values * are an array of limitation values. The limitation parameter is optional. * * @param mixed $contentId The groupId or userId to assign the role to. * @param mixed $roleId * @param array $limitation */ public function assignRole($contentId, $roleId, array $limitation = null) { $limitation = $limitation ?: array('' => array('')); $this->userGateway->assignRole($contentId, $roleId, $limitation); }