Exemplo n.º 1
0
 def principal(self, request, tag):
     """
     Top-level renderer in the template.
     """
     record = self.resource.parent.record
     resource = self.resource
     parent = self.resource.parent
     try:
         if isinstance(record.guid, uuid.UUID):
             guid = str(record.guid).upper()
         else:
             guid = record.guid
     except AttributeError:
         guid = ""
     return tag.fillSlots(
         directoryGUID=record.service.guid,
         realm=record.service.realmName,
         guid=guid,
         recordType=record.service.recordTypeToOldName(record.recordType),
         shortNames=record.shortNames,
         fullName=record.displayName,
         principalUID=parent.principalUID(),
         principalURL=formatLink(parent.principalURL()),
         proxyPrincipalUID=resource.principalUID(),
         proxyPrincipalURL=formatLink(resource.principalURL()),
         alternateURIs=formatLinks(resource.alternateURIs()),
         groupMembers=resource.groupMembers().addCallback(formatPrincipals),
         groupMemberships=resource.groupMemberships().addCallback(
             formatPrincipals
         ),
     )
 def principal(self, request, tag):
     """
     Top-level renderer in the template.
     """
     record = self.resource.parent.record
     resource = self.resource
     parent = self.resource.parent
     try:
         if isinstance(record.guid, uuid.UUID):
             guid = str(record.guid).upper()
         else:
             guid = record.guid
     except AttributeError:
         guid = ""
     try:
         shortNames = record.shortNames
     except AttributeError:
         shortNames = []
     return tag.fillSlots(
         directoryGUID=record.service.guid,
         realm=record.service.realmName,
         guid=guid,
         recordType=record.service.recordTypeToOldName(record.recordType),
         shortNames=shortNames,
         fullName=record.displayName,
         principalUID=parent.principalUID(),
         principalURL=formatLink(parent.principalURL()),
         proxyPrincipalUID=resource.principalUID(),
         proxyPrincipalURL=formatLink(resource.principalURL()),
         alternateURIs=formatLinks(resource.alternateURIs()),
         groupMembers=resource.groupMembers().addCallback(formatPrincipals),
         groupMemberships=resource.groupMemberships().addCallback(
             formatPrincipals
         ),
     )
Exemplo n.º 3
0
 def principal(self, request, tag):
     """
     Top-level renderer in the template.
     """
     record = self.resource.record
     try:
         if isinstance(record.guid, uuid.UUID):
             guid = str(record.guid).upper()
         else:
             guid = record.guid
     except AttributeError:
         guid = ""
     try:
         emailAddresses = record.emailAddresses
     except AttributeError:
         emailAddresses = []
     try:
         shortNames = record.shortNames
     except AttributeError:
         shortNames = []
     return tag.fillSlots(
         directoryGUID=str(record.service.guid),
         realm=record.service.realmName.encode("utf-8"),
         principalGUID=guid,
         recordType=record.service.recordTypeToOldName(record.recordType),
         shortNames=",".join([n.encode("utf-8") for n in shortNames]),
         fullName=record.displayName.encode("utf-8"),
         emailAddresses=formatList(emailAddresses),
         principalUID=str(self.resource.principalUID()),
         principalURL=formatLink(self.resource.principalURL()),
         alternateURIs=formatLinks(self.resource.alternateURIs()),
         groupMembers=self.resource.groupMembers().addCallback(
             formatPrincipals
         ),
         groupMemberships=self.resource.groupMemberships().addCallback(
             formatPrincipals
         ),
         readWriteProxyFor=self.resource.proxyFor(True).addCallback(
             formatPrincipals
         ),
         readOnlyProxyFor=self.resource.proxyFor(False).addCallback(
             formatPrincipals
         ),
     )