Multi Tenant programmatically add tenant administrators

Hi There,

How can I programmatically add tenant Administrators?

I'm currently trying this:

String query = String.format(
                "SELECT * FROM Document WHERE tenantconfig:tenantId = '%s'",
                tenantId);
        List<DocumentModel> docs = session.query(query);
        if (!docs.isEmpty()) {
            DocumentModel tenant = docs.get(0);
            List<String> tenantAdministrators = (List<String>) tenant.getPropertyValue(TENANT_ADMINISTRATORS_PROPERTY);
            tenantAdministrators.add("some username");
            tenant.setProperty("tenantconfig","administrators", tenantAdministrators); 
        }

But this does not seem to work.

Thanks in advance, Bauke Roo

0 votes

2 answers

1263 views

ANSWER



hi ,

i am developing a small application to handle multi domain as Multi Tenant , i am able to see the changes or List of Tenant in the Nuxeo ui but i am developing the application using angular 8 as a frontend and middleware is java spring boot api which is implementing the java client sdk of nuxeo . but i did not find any class or methods in java client sdk which gives me the Multi tenant manipulation like

  • fetch the list of Tenant
  • fetch the Tenant administrator group
  • member group
  • assignin the administrator to the Tenant Could any one help men in this

thanks Bhagat Singh

0 votes



It seems to be still early in the morning…

It is needed to save the document after changing the property :-)

session.saveDocument(tenant);
session.save();

Bauke Roo

0 votes