/** * @param string $uid * @param \OC_User_Backend $backend * @param Emitter $emitter */ public function __construct($uid, $backend, $emitter = null) { $this->uid = $uid; if ($backend and $backend->implementsActions(OC_USER_BACKEND_GET_DISPLAYNAME)) { $this->displayName = $backend->getDisplayName($uid); } else { $this->displayName = $uid; } $this->backend = $backend; $this->emitter = $emitter; $enabled = \OC_Preferences::getValue($uid, 'core', 'enabled', 'true'); //TODO: DI for OC_Preferences $this->enabled = $enabled === 'true'; }
/** * @param string $uid * @param \OC_User_Backend $backend * @param \OC\Hooks\Emitter $emitter * @param \OC\AllConfig $config */ public function __construct($uid, $backend, $emitter = null, $config = null) { $this->uid = $uid; if ($backend and $backend->implementsActions(OC_USER_BACKEND_GET_DISPLAYNAME)) { $this->displayName = $backend->getDisplayName($uid); } else { $this->displayName = $uid; } $this->backend = $backend; $this->emitter = $emitter; $this->config = $config; if ($this->config) { $enabled = $this->config->getUserValue($uid, 'core', 'enabled', 'true'); $this->enabled = $enabled === 'true'; } else { $this->enabled = true; } }