public function testInitializeRole() { $acl = new LeanACL(); $acl->setPublicWriteAccess(true); // so it can be destroyed $role = new LeanRole("guest", $acl); $role->save(); $this->assertNotEmpty($role->getObjectId()); $childrenUsers = $role->getUsers(); $this->assertTrue($childrenUsers instanceof LeanRelation); $childrenRoles = $role->getRoles(); $this->assertTrue($childrenRoles instanceof LeanRelation); $role->destroy(); }
/** * Initialize application key and settings * * @param string $appId Application ID * @param string $appKey Application key * @param string $appMasterKey Application master key */ public static function initialize($appId, $appKey, $appMasterKey) { self::$appId = $appId; self::$appKey = $appKey; self::$appMasterKey = $appMasterKey; self::$defaultHeaders = array('X-LC-Id' => self::$appId, 'Content-Type' => 'application/json;charset=utf-8', 'User-Agent' => self::getVersionString()); // Use session storage by default if (!self::$storage) { self::$storage = new SessionStorage(); } LeanUser::registerClass(); LeanRole::registerClass(); }