def groupsToRefresh(self, txn): delegatedUIDs = set((yield txn.allGroupDelegates())) self.log.debug( "There are {count} group delegates", count=len(delegatedUIDs) ) # Also get group delegates from other pods if txn.directoryService().serversDB() is not None and len(txn.directoryService().serversDB().allServersExceptThis()) != 0: results = yield DeferredList([ txn.store().conduit.send_all_group_delegates(txn, server) for server in txn.directoryService().serversDB().allServersExceptThis() ], consumeErrors=True) for result in results: if result and result[0]: delegatedUIDs.update(result[1]) self.log.debug( "There are {count} group delegates on this and other pods", count=len(delegatedUIDs) ) # Get groupUIDs for all group attendees groups = yield GroupsRecord.query( txn, GroupsRecord.groupID.In(GroupAttendeeRecord.queryExpr( expr=None, attributes=(GroupAttendeeRecord.groupID,), distinct=True, )) ) attendeeGroupUIDs = frozenset([group.groupUID for group in groups]) self.log.debug( "There are {count} group attendees", count=len(attendeeGroupUIDs) ) # Get groupUIDs for all group shares gs = schema.GROUP_SHAREE gr = schema.GROUPS rows = yield Select( [gr.GROUP_UID], From=gr, Where=gr.GROUP_ID.In( Select( [gs.GROUP_ID], From=gs, Distinct=True ) ) ).on(txn) shareeGroupUIDs = frozenset([row[0] for row in rows]) self.log.debug( "There are {count} group sharees", count=len(shareeGroupUIDs) ) returnValue(frozenset(delegatedUIDs | attendeeGroupUIDs | shareeGroupUIDs))
def groupsToRefresh(self, txn): delegatedUIDs = set((yield txn.allGroupDelegates())) self.log.debug("There are {count} group delegates", count=len(delegatedUIDs)) # Also get group delegates from other pods if (txn.directoryService().serversDB() is not None and len(txn.directoryService().serversDB().allServersExceptThis( filter_v5=True)) != 0): results = yield DeferredList([ txn.store().conduit.send_all_group_delegates(txn, server) for server in txn.directoryService().serversDB(). allServersExceptThis(filter_v5=True) ], consumeErrors=True) for result in results: if result and result[0]: delegatedUIDs.update(result[1]) self.log.debug( "There are {count} group delegates on this and other pods", count=len(delegatedUIDs)) # Get groupUIDs for all group attendees groups = yield GroupsRecord.query( txn, GroupsRecord.groupID.In( GroupAttendeeRecord.queryExpr( expr=None, attributes=(GroupAttendeeRecord.groupID, ), distinct=True, ))) attendeeGroupUIDs = frozenset([group.groupUID for group in groups]) self.log.debug("There are {count} group attendees", count=len(attendeeGroupUIDs)) # Get groupUIDs for all group shares gs = schema.GROUP_SHAREE gr = schema.GROUPS rows = yield Select([gr.GROUP_UID], From=gr, Where=gr.GROUP_ID.In( Select([gs.GROUP_ID], From=gs, Distinct=True))).on(txn) shareeGroupUIDs = frozenset([row[0] for row in rows]) self.log.debug("There are {count} group sharees", count=len(shareeGroupUIDs)) returnValue( frozenset(delegatedUIDs | attendeeGroupUIDs | shareeGroupUIDs))