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


PHP PFUser::getUnixHomeDir方法代码示例

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


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

示例1: writeSSHKeys

 /**
  * Write SSH authorized_keys into a user homedir
  *
  * @param PFUser $user
  *
  * @return Boolean
  */
 public function writeSSHKeys(PFUser $user)
 {
     try {
         if ($user->getUnixStatus() != 'A') {
             return true;
         }
         $ssh_dir = $user->getUnixHomeDir() . '/.ssh';
         // Subtlety: between the 2 process owner change, there is no way to
         // write any logs because the process is owned by a mere user but
         // the log file is only writtable by codendiadm and root. So the
         // exceptions... welcome to the real world Neo.
         $this->changeProcessUidGidToUser($user);
         $this->createSSHDirForUser($user, $ssh_dir);
         $this->writeSSHFile($user, $ssh_dir);
         $this->restoreRootUidGid();
         $this->backend->changeOwnerGroupMode($ssh_dir, $user->getUserName(), $user->getUserName(), 0700);
         $this->backend->changeOwnerGroupMode("{$ssh_dir}/authorized_keys", $user->getUserName(), $user->getUserName(), 0600);
         $this->backend->log("Authorized_keys for " . $user->getUserName() . " written.", Backend::LOG_INFO);
         return true;
     } catch (Exception $exception) {
         $this->restoreRootUidGid();
         $this->backend->log($exception->getMessage(), Backend::LOG_ERROR);
         return false;
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:32,代码来源:User_SSHKeyDumper.class.php

示例2: setUserHomeOwnership

 /**
  * Set user's uid/gid on its home directory (recursively)
  * 
  * @param PFUser $user user to set uid/gid
  * 
  * @return null
  */
 private function setUserHomeOwnership(PFUser $user)
 {
     $this->recurseChownChgrp($user->getUnixHomeDir(), $user->getUserName(), $user->getUserName());
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:11,代码来源:BackendSystem.class.php


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