当前位置: 首页>>代码示例>>PHP>>正文


PHP PFUser::setAuthorizedKeys方法代码示例

本文整理汇总了PHP中PFUser::setAuthorizedKeys方法的典型用法代码示例。如果您正苦于以下问题:PHP PFUser::setAuthorizedKeys方法的具体用法?PHP PFUser::setAuthorizedKeys怎么用?PHP PFUser::setAuthorizedKeys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PFUser的用法示例。


在下文中一共展示了PFUser::setAuthorizedKeys方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: generateUsers

 public function generateUsers()
 {
     $user_1 = new PFUser();
     $user_1->setUserName(self::TEST_USER_1_NAME);
     $user_1->setRealName(self::TEST_USER_1_REALNAME);
     $user_1->setLdapId(self::TEST_USER_1_LDAPID);
     $user_1->setPassword(self::TEST_USER_1_PASS);
     $user_1->setStatus(self::TEST_USER_1_STATUS);
     $user_1->setEmail(self::TEST_USER_1_EMAIL);
     $user_1->setLanguage($GLOBALS['Language']);
     $this->user_manager->createAccount($user_1);
     $user_1->setLabFeatures(true);
     $user_2 = new PFUser();
     $user_2->setUserName(self::TEST_USER_2_NAME);
     $user_2->setPassword(self::TEST_USER_2_PASS);
     $user_2->setStatus(self::TEST_USER_2_STATUS);
     $user_2->setEmail(self::TEST_USER_2_EMAIL);
     $user_2->setLanguage($GLOBALS['Language']);
     $user_2->setAuthorizedKeys('ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHk9 toto@marche');
     $this->user_manager->createAccount($user_2);
     $user_3 = new PFUser();
     $user_3->setUserName(self::TEST_USER_3_NAME);
     $user_3->setPassword(self::TEST_USER_3_PASS);
     $user_3->setStatus(self::TEST_USER_3_STATUS);
     $user_3->setEmail(self::TEST_USER_3_EMAIL);
     $user_3->setLanguage($GLOBALS['Language']);
     $this->user_manager->createAccount($user_3);
     $user_4 = new PFUser();
     $user_4->setUserName(self::TEST_USER_4_NAME);
     $user_4->setPassword(self::TEST_USER_4_PASS);
     $user_4->setStatus(self::TEST_USER_4_STATUS);
     $user_4->setEmail(self::TEST_USER_1_EMAIL);
     $user_4->setLanguage($GLOBALS['Language']);
     $this->user_manager->createAccount($user_4);
     return $this;
 }
开发者ID:ndjido,项目名称:tuleap,代码行数:36,代码来源:TestDataBuilder.php

示例2: getKeysFromString

 private function getKeysFromString($keys_as_string)
 {
     $user = new PFUser();
     $user->setAuthorizedKeys($keys_as_string);
     return array_filter($user->getAuthorizedKeysArray());
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:6,代码来源:SystemEvent_GIT_EDIT_SSH_KEYS.class.php

示例3: updateUserSSHKeys

 /**
  * Update ssh keys for a user
  *
  * Should probably be merged with updateDb but I don't know the impact of
  * validating keys each time we update a user
  *
  * @param PFUser $user
  * @param String $keys
  */
 public function updateUserSSHKeys(PFUser $user, array $keys)
 {
     $original_authorised_keys = $user->getAuthorizedKeysRaw();
     $user->setAuthorizedKeys(implode(PFUser::SSH_KEY_SEPARATOR, $keys));
     if ($this->updateDb($user)) {
         $GLOBALS['Response']->addFeedback('info', $GLOBALS['Language']->getText('account_editsshkeys', 'update_filesystem'));
         $event_parameters = array('user_id' => $user->getId(), 'original_keys' => $original_authorised_keys);
         $this->_getEventManager()->processEvent(Event::EDIT_SSH_KEYS, $event_parameters);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:19,代码来源:UserManager.class.php

示例4: itRemovesSelectedSSHKeys

     public function itRemovesSelectedSSHKeys() {
        $user_ssh_keys =
            'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7pihW/WsGL8Pmk89ET/x1GTa646GWs/7DHujgxfP4ZH7mt6ta+KwH2tsEj5ESS19EIYG4hQYpckpd65fgihs7SrwLEVG3yO1gZSS+4bBfGaR/zQoFRNlJHiKh9vrr3AZZxCUUM4xpMi2wT4hBlr8lgYaxCQZpgXRqI6CSUSAVDM7e6Ct4zItmp7VqFLHTv7pljeIF+VTyoDWfMSaIBbDmmnZctR9hR3ywSmokvA9iN4a5bWjeXlIQdpjcjqapolvlo2XamN7HRTfxWefFceoVX3yVjTZ7DFkbHJdqwBMIQmAMbG633dx67dQLgeAKfWu/tGbCnalnzzeuMvU9b4oF comment1'
            . PFUser::SSH_KEY_SEPARATOR . $this->an_ssh_key;

        $ssh_keys_to_delete_index = array(0);

        $this->user->setAuthorizedKeys($user_ssh_keys);

        expect($this->user_manager)->updateUserSSHKeys($this->user, array($this->an_ssh_key))->once();

        $this->user_manager->deleteSSHKeys($this->user, $ssh_keys_to_delete_index);
    }
开发者ID:rinodung,项目名称:tuleap,代码行数:13,代码来源:UserManagerTest.php


注:本文中的PFUser::setAuthorizedKeys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。