Ejemplo n.º 1
0
Archivo: user.php Proyecto: 0x17de/core
 /**
  * fetches the quota from LDAP and stores it as ownCloud user value
  * @param string $valueFromLDAP the quota attribute's value can be passed,
  * to save the readAttribute request
  * @return null
  */
 public function updateQuota($valueFromLDAP = null)
 {
     if ($this->wasRefreshed('quota')) {
         return;
     }
     //can be null
     $quotaDefault = $this->connection->ldapQuotaDefault;
     $quota = !is_null($valueFromLDAP) ? $valueFromLDAP : $quotaDefault !== '' ? $quotaDefault : null;
     if (is_null($valueFromLDAP)) {
         $quotaAttribute = $this->connection->ldapQuotaAttribute;
         if (!empty($quotaAttribute)) {
             $aQuota = $this->access->readAttribute($this->dn, $quotaAttribute);
             if ($aQuota && count($aQuota) > 0) {
                 $quota = $aQuota[0];
             }
         }
     }
     if (!is_null($quota)) {
         $this->config->setUserValue($this->uid, 'files', 'quota', $quota);
     }
 }
Ejemplo n.º 2
0
 /**
  * @brief fetches the quota from LDAP and stores it as ownCloud user value
  * @return null
  */
 public function updateQuota()
 {
     if ($this->wasRefreshed('quota')) {
         return;
     }
     $quota = null;
     $quotaDefault = $this->connection->ldapQuotaDefault;
     $quotaAttribute = $this->connection->ldapQuotaAttribute;
     if (!empty($quotaDefault)) {
         $quota = $quotaDefault;
     }
     if (!empty($quotaAttribute)) {
         $aQuota = $this->access->readAttribute($this->dn, $quotaAttribute);
         if ($aQuota && count($aQuota) > 0) {
             $quota = $aQuota[0];
         }
     }
     if (!is_null($quota)) {
         $this->config->setUserValue($this->uid, 'files', 'quota', $quota);
     }
 }