In my ACS application, a User can create a PhotoCollection. They can then assign access to this PhotoCollection to any of the Users in their Friends list. This relationship is defined using a CustomObject.
But I can't find a way to enable a User to retrieve the PhotoCollections to which they have access.
Custom Object
Cloud.Objects.create({ classname: 'photocollection_user', fields: { // TODO: "Error: Invalid ACS Type: photocollection" //"[ACS_PhotoCollection]photocollection_id": photocollection_id, "photocollection_id": photocollection_id, "[ACS_User]user_id": user_id } }, function (e) { // });Ideally, I would have been able to set "[ACS_PhotoCollection]photocollection_id": photocollection_id, but ACS returns an invalid acs type error. If it had worked, when I query this custom object by user_id, the photocollection_id relational field would have simultaneously retrieved the photocollection (as it does with the user) in the single query.
But as it doesn't (it is in beta), I looked at building an array of the photocollection_ids to request from one of these queries: ACS PhotoCollections:
- collections/search.json (top level collections for user_id)
- collections/show.json (retrieve single collection by collection_id)
But search() accepts a user_id and returns their top level PhotoCollections, and show() only accepts a single PhotoCollection id, meaning I would have to loop through and query 1 by 1. I tried passing it a coma-delimited string as you can do with some of the other ACS objects but it would only accept a single id.
So, is there something else I can do, or:
- Will Relational Fields soon support PhotoCollection
- Will the PhotoCollection methods enable a search/query by multiple ids
I did look a while ago at potentially defining the relationships via the ACL's, but there was no way to query these for a user to see which objects it had access to. The ACL seemed purely a security measure and not a way to define queryable relationships between users and acs objects,
Cheers!