Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MultiTenancy - Call to a member function getName() on null #971

Open
Jakan opened this issue May 28, 2023 · 1 comment
Open

MultiTenancy - Call to a member function getName() on null #971

Jakan opened this issue May 28, 2023 · 1 comment
Assignees

Comments

@Jakan
Copy link

Jakan commented May 28, 2023

Hi,

I have the following configuration:
A "Users" table with columns id, username and password (hash), tenant_id and role.

The following configuration of the api.php

        'address' => 'db',
        'username' => 'username',
        'password' => 'xxxxxxxxxxxx',
        'database' => 'database',
        'middlewares' => 'sanitation,cors,dbAuth,multiTenancy,authorization',
        'cors.allowHeaders' => ("Content-Type, X-XSRF-TOKEN, X-Authorization"),
        'cors.allowCredentials' => 'true',
        'dbAuth.registerUser' => '1',
         'multiTenancy.handler' => function ($operation, $tableName) {
             return ['tenant_id' => $_SESSION['user']['tenant_id']];
        },
        'authorization.tableHandler' => function ($operation, $tableName) {
            return $tableName != 'users';
        },
        'sanitation.handler' => function ($operation, $tableName, $column, $value) {
            return is_string($value) ? strip_tags($value) : $value;
        },
        'debug' => true

If I take out the dbAuth and Authorization, it works and I get the data returned (GET - records/...).

When calling the login route I get the error:
POST: https://url/services/api.php/login

{
  "code": 9999,
  "message": "Call to a member function getName() on null"
}

What could be the reason?
It runs in a docker container.

Greetings

Jayken

@mevdschee mevdschee self-assigned this Jun 15, 2023
@mevdschee
Copy link
Owner

I'm really sorry for the late reply, but the response should also contain debug (http) headers, can you post the output of those as well? You can use your favorite tool (or curl i-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants