I am wondering if it’s possible to transfer the ownership of a company.
My cousin wants to use it but I don’t feel comfortable being able to see his invoices. I tried to delete my account from his company using his account but it says I can’t delete the owner. Also, I am not able to create companies using his account even though I have set him as an Admin.
If it’s not possible I am probably going to ask him to create his own account on invoiceninja.com or deploy it on his server as I did.
@hillel thank you! Gonna deploy a new instance to him then.
One thing I noticed, if I have a user assigned to a company and remove them from the company. The application will ask the removed user to login again but once I try to login I will get a 500 error.
Checked into the logs and found the error below:
[2022-05-02 03:47:02] production.ERROR: Attempt to read property "is_owner" on null {"userId":5,"exception":"[object] (ErrorException(code: 0): Attempt to read property \"is_owner\" on null at (...)/app/Models/User.php:319)
@hillel I think when the user tries to login again, it will try to load the data from the company they were using for the last time. Since they don’t have access to the company anymore, the company will be null which will then throw that error.
User.php:317
public function isOwner() : bool
{
return $this->token()->cu->is_owner;
}
User.php:147
public function token() {
$truth = app()->make(TruthSource::class);
if($truth->getCompanyToken()){
return $truth->getCompanyToken();
}
if (request()->header('X-API-TOKEN')) {
return CompanyToken::with(['cu'])->where('token', request()->header('X-API-TOKEN'))->first();
}
return $this->tokens()->first();
}
@david I removed the user from the company using the application.
So, I had my main user logged in in on MS Edge and the other user on FF, after I removed the user from the company, I refreshed the page and it asked me to sign in again, when I try to do so, it’ll display the 500 error.
As a workaround, I added the user back to the company with my admin one, signed in again with that user, selected another company and finally removed them again from the first company. Doing so I didn’t get any error. That’s why I think the application is trying to load the data from the last company the user has selected.