Talk:Gallery2:Embedding:Development Roadmap - Gallery Codex
Personal tools

Talk:Gallery2:Embedding:Development Roadmap

From Gallery Codex

kiz_0987: Not sure if this is the best place for this, but I have added (beta) group support to the Drupal G2 integration. In the process of doing this I found some non-ideal (for me anyway) functioning of the Embed code and some future ideas, which I thought could be useful to share.

Current issues (for me - if there were better ways to do this please let me know, I'd love to make it simpler):

  • Drupal does not have events for group add/remove, so I had to add a group sync function when a user is modified. This retreives G2 User ID (using loadEntityByExternalId -- seems overkill) as I could not find an API which just gives the G2 User ID from an External User ID. Then it gets the groups for this user. To do a comparison, all the External Group IDs were mapped into G2 Group IDs. Once the comparison is done the user is either added or removed from the groups. This was more complex that I thought it would have to be and note that none of this used the GalleryEmbed code.
  • Related to this, GalleryEmbed::getExternalIdMap did not seem ideal. This returns the whole map (it would be good to get a single entry) keyed as either 'entityId' or 'externalId'. But there is no way to make it only for 'GalleryGroup' or 'GalleryUser'. Since Drupal uses similar numeric Ids for groups and users, returning as 'externalId' returns what when the numeric Id for a user and a group is the same? It seemed to return the group (maybe as it was newer), but this could not be relied upon. So I had to return by 'entityId', go through the array and extract the info I wanted.
  • GalleryEmbed::deleteGroup can remove protected groups (such as Site Admin).

Future options:

  • List of albums for other users. I added a (flat) list of link to the user's albums, but can be useful for one user to get G2 information about another. For example, two people in the same group (or an admin) may want to view the album list of each other. This requires logging to G2 as one user but retrieving information about another. The current fetchAllItemIdsByOwnerId does not obey permissions, so this is insecure.
  • Sync. I look forward to the real user and group sync functions in the core code (I know it's being worked on). One question, will the hooks be available so that I can present this information to users as part of normal Drupal user pages instead of a specific G2 admin page?

--Valiant 17:26, 10 January 2006 (PST)

  • Lack of events for add / create group in drupal:
    • IMO you should push the drupal core devs, i strongly believe in the concept of loose integration by interfaces and events and the lack thereof makes drupal a weak partner for integration.
    • GalleryCoreApi::loadEntityByExternalId() is a good way to get the matching group. You can as well query the ExternalIdMap with your externalId + entityTye = GalleryGroup to get the entityId.
    • Simplifying this with a new GalleryEmbed function is a viable alternative. Please submit a patch. Or file a feature request.
  • GalleryEmbed::getExternalIdMap not ideal:
    • It serves a specific purpose. When doing the user synchronization and you're not sure if G2 and the other application were integrated before, you don't know if the users are already mapped. So you load the whole map table at once into memory. The alternative would be to query xxxxxx times the same table for subsequent rows.
  • GalleryEmbed::deleteGroup can remove protected groups (such as Site Admin).
    • Fixed in the nightly snapshot of 2005/01/11, thanks for reporting. Also, the anonymous user can no longer be deleted.
  • list of albums of users
    • there's already the member module of g2. add the member block to the sidebar to get a link to the members page, click on a g2 user to get his albums etc.
  • user/group synchronization
    • yes, you'll be able to add a link in drupal / your application which initiates the synchronization.
advertisements