Identify photos that were hidden in G2 and are now visible

Select all photos where the group ‘Everybody’ does not have the ‘core.ViewAll’ permission and where the photo is not in an album which already prevents ‘Everybody’ from having ‘core.ViewAll’

select a.g_title, a.g_description, e.g_bits, a.g_id, f.g_parentId from 
g2_Item as a, 
g2_AccessSubscriberMap as b, 
g2_AccessMap as c,
g2_Group as d,
g2_PermissionSetMap as e,
g2_ChildEntity as f
where 
a.g_canContainChildren = 0 and                                        /* show photos (not albums) ... */
a.g_id = b.g_itemId and b.g_accessListId = c.g_accessListId and       /* that have a g_accessListId ... */
c.g_userOrGroupId = d.g_id and  d.g_groupName = 'Everybody' and       /* which, for the group 'Everybody' ... */
c.g_permission & e.g_bits = 0 and e.g_permission = 'core.viewAll' and /* disallows viewing them */
a.g_id = f.g_id and
not exists (                      /* if there exists no parent as described below */
select ax.g_id from 
g2_Item as ax, 
g2_AccessSubscriberMap as bx, 
g2_AccessMap as cx,
g2_Group as dx,
g2_PermissionSetMap as ex
where 
ax.g_canContainChildren = 1 and                                           /* show an album (not photo) ... */
ax.g_id = f.g_parentId and f.g_id = a.g_id and                            /* which is the parent of the photo identified in the first select and */
ax.g_id = bx.g_itemId and bx.g_accessListId = cx.g_accessListId and       /* that has a g_accessListId ... */
cx.g_userOrGroupId = dx.g_id and dx.g_groupName = 'Everybody' and         /* which, for the group 'Everybody' ... */
cx.g_permission & ex.g_bits = 0 and ex.g_permission = 'core.viewAll'      /* disallows viewing it */
)

Todo

  • Create a query that looks for all photos which have permissions g_permission values that differ from their parent albums
  • Create a query that looks for all items that have g_userOrGroupId of a user, not a group