How to get Users "Controlled Profiles" via AXL?

Version 1
    This document was generated from CDN thread

    Created by: Thomas Beck on 18-06-2009 02:02:38 PM
    How to get Users "Controlled Profiles" via executeSQLQuery:
    Getting all the Endusers: SELECT * FROM enduser
    Getting the Device-Profiles: SELECT * FROM device WHERE tkdeviceprofile='1'
    But how to combine them? Which Profile can be used by which user (Enduser -> Extension Mobility -> Controlled Profiles)?

    Subject: RE: How to get Users "Controlled Profiles" via AXL?
    Replied by: David Staudt on 18-06-2009 03:15:09 PM
    The enduserdevicemap table stores the relationship between users and devices (including device profiles.)  To get the controlled device profiles for a single user, the query would look something like:
    select device.* from device, enduserdevicemap, enduser
        where enduserdevicemap.fkenduser = enduser.pkid and
        enduserdevicemap.fkdevice = device.pkid and
        device.tkdeviceprofile=1 and
        enduser.userid = 'jdoe'