You can get all locks using the operational command API.
Note: That API call will retreive the commit locks. For config locks, change <commit-locks/> to <config-locks/>.
The following text is an example response from that API call perfomed on Panorama 7.1.0. There are two locks in the example output below. You can tell by the lines in red that one of these locks is global (shared) and one of these locks is specific to a device-group called "My Device Group".
<name>My Device Group</name>
<![CDATA[This is a device-group lock]]>
<![CDATA[This is a global (shared) lock]]>
... View more