Skip to content

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

@Jakan

Description

@Jakan

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

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions