Thanks, I guess I wasn't very clear. Here's a better description of the problem:
Sloan modified the code in dotlrn-fs, add_applet_to_community(), to modify the permissions of the community's Public Files folder so that not even admins could delete or rename it. This is not just any public folder; it's a specific one named <community>'s Public Files.
The same code change needed to be made to the clone() proc as well, which I just did. Now I need to modify permissions for all the Public Files folders in all the classes that have been created recently by cloning.
It's easy to get a list of all the folder_ids from cr_folders; anything with a label like '%Public Files' will do. But the code I need to execute looks like this:
permission::set_not_inherit -object_id $public_folder_id
permission::grant -party_id $admins -object_id $public_folder_id -privilege write
set dotlrn_public [dotlrn::get_users_rel_segment_id]
permission::grant -party_id $dotlrn_public -object_id $public_folder_id -privilege read
And for this I have to be able to figure out a list of the user_ids of the admins for each community, so I set things up properly. And that means I need to figure out the community_id for each folder.
I will study your query - it looks like it might do what I need, even though I didn't explain it very well. Thanks!