Esempio n. 1
0
    def resolve_guid(self, guid):
        """
		Return the LDAP record with the provided GUID.

		@guid: the guid to search for.

		@throw ActiveDirectoryInvalidGUID if the GUID is not a valid GUID.
		@return the record corresponding to the guid queried.
		"""
        if validate_guid(guid):
            results = self.query(f"(&(ObjectGUID={guid}))")
            # Normally only one result should have been retrieved:
            if results:
                return results
        raise self.ActiveDirectoryInvalidGUID(f"GUID: {guid}")
Esempio n. 2
0
    def resolve_guid(self, guid):
        """
		Return the cache record with the provided GUID.

		@guid: the guid to search for.

		@throw ActiveDirectoryInvalidGUID if the GUID is not a valid GUID.
		@return the record corresponding to the guid queried.
		"""
        if validate_guid(guid):
            results = self.query({
                "fmt": "json",
                "files": ["users_all", "groups", "machines"],
                "filter": lambda x: x["objectGUID"] == guid
            })
            if results:
                return results
        raise self.ActiveDirectoryInvalidGUID(f"GUID: {guid}")