Пример #1
0
 /**
  * Construct a Home storage instance
  * @param array $arguments array with "user" containing the
  * storage owner and "legacy" containing "true" if the storage is
  * a legacy storage with "local::" URL instead of the new "home::" one.
  */
 public function __construct($arguments)
 {
     $this->user = $arguments['user'];
     $datadir = $this->user->getHome();
     if (isset($arguments['legacy']) && $arguments['legacy']) {
         // legacy home id (<= 5.0.12)
         $this->id = 'local::' . $datadir . '/';
     } else {
         $this->id = 'home::' . $this->user->getUID();
     }
     parent::__construct(array('datadir' => $datadir));
 }
 /**
  * Send a mail signaling user creation
  * @param \OC\User\User $user
  */
 public function mailUserCreation(\OC\User\User $user)
 {
     $toAddress = $toName = $this->config->getSystemValue('monitoring_admin_email');
     $theme = new \OC_Defaults();
     $now = new \DateTime();
     $niceNow = date_format($now, 'd/m/Y H:i:s');
     $subject = (string) $this->l->t('%s - User %s just has been created (%s)', array($theme->getTitle(), $user->getUID(), $niceNow));
     $html = new \OCP\Template($this->appName, "mail_usercreation_html", "");
     $html->assign('userUID', $user->getUID());
     $html->assign('datetime', $niceNow);
     $html->assign('home', $user->getHome());
     $htmlMail = $html->fetchPage();
     $alttext = new \OCP\Template($this->appName, "mail_usercreation_text", "");
     $alttext->assign('userUID', $user->getUID());
     $alttext->assign('datetime', $niceNow);
     $alttext->assign('home', $user->getHome());
     $altMail = $alttext->fetchPage();
     $fromAddress = $fromName = \OCP\Util::getDefaultEmailAddress('owncloud');
     try {
         \OCP\Util::sendMail($toAddress, $toName, $subject, $htmlMail, $fromAddress, $fromName, 1, $altMail);
     } catch (\Exception $e) {
         \OCP\Util::writeLog('user_account_actions', "Can't send mail for user creation: " . $e->getMessage(), \OCP\Util::ERROR);
     }
 }
Пример #3
0
 function testGetCertificateBundle()
 {
     $this->assertSame($this->user->getHome() . '/files_external/rootcerts.crt', $this->certificateManager->getCertificateBundle());
 }