public function RPCObjectByName($name) { switch ($this->ObjectConf['ClassName']) { case 'User': return User::byName($name); case 'Group': return Group::byName($name); case 'gui': return gui::byName($name); default: // or throw exception ? return null; } }
$user->postalCode = $postal_code; $user->city = $city; $user->country = $country; $user->create(); $user->setNewUserPasswordTicket(); if ($withPasswordInsertion == 'true' && $password !== '' && $user->validUserPasswordTicket($user->passwordTicket)) { $user->setPassword($password, $user->passwordTicket); } // TODO: uuid() ???? } } #update if ($action == 'update') { //check sercurity: // has the user all permissions to do that $user = User::byName($name); if (!is_null($user) && intval($user->id) !== intval($selected_user)) { echo "<script language='JavaScript'>alert('" . _mb("Username must be unique!") . "');</script>"; } else { $user = new User(intval($selected_user)); $user->name = $name; $user->owner = $owner_id; $user->description = $description; $user->email = $email; $user->phone = $phone; $user->department = $department; $user->organization = $organization; $user->position = $position; $user->resolution = $resolution; $user->firstName = $firstname; $user->lastName = $lastname;
public function change($changes) { //FIXME: validate input if ($changes->owner) { $owner = User::byName($changes->owner); } $this->name = isset($changes->name) ? $changes->name : $this->name; $this->owner = isset($changes->owner) ? $owner->id : $this->owner; $this->description = isset($changes->description) ? $changes->description : $this->description; $this->loginCount = isset($changes->loginCount) ? $changes->loginCount : $this->loginCount; $this->email = isset($changes->email) ? $changes->email : $this->email; $this->phone = isset($changes->phone) ? $changes->phone : $this->phone; $this->department = isset($changes->department) ? $changes->department : $this->department; $this->resolution = isset($changes->resolution) ? $changes->resolution : $this->resolution; $this->organization = isset($changes->organization) ? $changes->organization : $this->organization; $this->position = isset($changes->position) ? $changes->position : $this->position; $this->phone1 = isset($changes->phone1) ? $changes->phone1 : $this->phone1; $this->facsimile = isset($changes->facsimile) ? $changes->facsimile : $this->facsimile; $this->deliveryPoint = isset($changes->deliveryPoint) ? $changes->deliveryPoint : $this->deliveryPoint; $this->city = isset($changes->city) ? $changes->city : $this->city; $this->postalCode = isset($changes->postalCode) ? $changes->postalCode : $this->postalCode; $this->country = isset($changes->country) ? $changes->country : $this->country; $this->url = isset($changes->url) ? $changes->url : $this->url; $this->id = isset($changes->id) ? $changes->id : $this->id; $this->realName = isset($changes->realName) ? $changes->realName : $this->realName; $this->street = isset($changes->street) ? $changes->street : $this->street; $this->houseNumber = isset($changes->houseNumber) ? $changes->houseNumber : $this->houseNumber; $this->reference = isset($changes->reference) ? $changes->reference : $this->reference; $this->forAttentionOf = isset($changes->forAttentionOf) ? $changes->forAttentionOf : $this->forAttentionOf; $this->validFrom = isset($changes->validFrom) ? $changes->validFrom : $this->validFrom; $this->validTo = isset($changes->validTo) ? $changes->validTo : $this->validTo; $this->passwordTicket = isset($changes->passwordTicket) ? $changes->passwordTicket : $this->passwordTicket; $this->firstName = isset($changes->firstName) ? $changes->firstName : $this->firstName; $this->lastName = isset($changes->lastName) ? $changes->lastName : $this->lastName; $this->academicTitle = isset($changes->academicTitle) ? $changes->academicTitle : $this->academicTitle; return true; }