/** * @brief constructor, make sure the subclasses call this one! * @param string the internal username * @param string the LDAP DN * @param IUserTools $access an instance that implements IUserTools for * LDAP interaction * @param \OCP\IConfig * @param FilesystemHelper * @param \OCP\Image any empty instance * @param LogWrapper * @param \OCP\IAvatarManager */ public function __construct($username, $dn, IUserTools $access, \OCP\IConfig $config, FilesystemHelper $fs, \OCP\Image $image, LogWrapper $log, \OCP\IAvatarManager $avatarManager) { $this->access = $access; $this->connection = $access->getConnection(); $this->config = $config; $this->fs = $fs; $this->dn = $dn; $this->uid = $username; $this->image = $image; $this->log = $log; $this->avatarManager = $avatarManager; }
/** * returns a list of attributes that will be processed further, e.g. quota, * email, displayname, or others. * @param bool $minimal - optional, set to true to skip attributes with big * payload * @return string[] */ public function getAttributes($minimal = false) { $attributes = array('dn', 'uid', 'samaccountname', 'memberof'); $possible = array($this->access->getConnection()->ldapQuotaAttribute, $this->access->getConnection()->ldapEmailAttribute, $this->access->getConnection()->ldapUserDisplayName, $this->access->getConnection()->ldapUserDisplayName2); foreach ($possible as $attr) { if (!is_null($attr)) { $attributes[] = $attr; } } $homeRule = $this->access->getConnection()->homeFolderNamingRule; if (strpos($homeRule, 'attr:') === 0) { $attributes[] = substr($homeRule, strlen('attr:')); } if (!$minimal) { // attributes that are not really important but may come with big // payload. $attributes = array_merge($attributes, array('jpegphoto', 'thumbnailphoto')); } return $attributes; }