1
API GetUser Problem / Build 9124 (Linux)
Problem reported by Alain W. - Yesterday at 2:03 AM
Submitted
After updating to SmarterMail Build 9124 the API calls to domain-GetUser fail with error 400.
It was working fine before (3 builds back, skipped updating for a couple of weeks).

Anybody else with this problem?

Edit: This seems to be the detailed response:
{
    message: "Domain does not exist.",
    success: false
}
(But the domain definitly hasn't changed at all)

3 Replies

Reply to Thread
0
Alain W. Replied
Is it possible that System Administrators cannot call GetUser anymore?

According to docs:
GetUser => Limited to Domain Admins
ImpersonateUser => Limited to System Admins


1
Tony Scholz Replied
Employee Post
Hello, 

I just tested this locally. If I authenticate as a system admin and then impersonate a domain admin, I can get the user's information. I can also get the results if I authenticate as a domain admin user. 

System Admin -> Impersonate a Domain admin

userToGet = 'acquaintances.sbin.testing'
payload = {"email":f"{userToGet}"}
postUrl = f'{ascholz.uri}api/v1/settings/domain/get-user'

ascholz.authenticate()
ascholz.impersonate_domain('ascholz.io')

post_results_systemAdmin_impersoante = requests.post(url=postUrl, json=payload, headers=ascholz.HeaderImpersonate) 
post_results_systemAdmin_impersoante # http 200
Domain admin 

userToGet = 'acquaintances.sbin.testing'
payload = {"email":f"{userToGet}"} postUrl = f'{ascholz.uri}api/v1/settings/domain/get-user' ascholzDomain = API(u='admin@ascholz.io', p='admin') post_results_domainAdmin = requests.post(url=postUrl, json=payload, headers=ascholzDomain.headers) post_results_domainAdmin # http 200

Let me know if this helps. Thanks
~Tony

Tony Scholz System/Network Administrator SmarterTools Inc. www.smartertools.com
0
Alain W. Replied
Hi Tony

Thanks, yes, I updated the code.

But before, the System Admin was "enough" to call the GetUser function directly.
Which I think was more reasonable.

(Impersonation was always restricted to System Admins.)

Cheers,
Alain

Reply to Thread