Hi,
I’ve done a script that I want to share also to verify that it’s done properly becase I’m modifying directly the database
We use circles intensively, but we found a “problem” related to shares strategy.
- We have a group folder
- one of the users of the group (user_A) creates a folder inside (projectX), creates a circle (subcircle_projectX), adds user_B and user_C to that circle and shares the folder projectX with subcircle_projectX.
- Everyone is happy and access to the files
- User_A changes its role and leaves subcircle_projectX: the share projectX-subcircle_projectX dissapears (because user_A is no longer part of the circle and share belongs to him). Now userB and userC cannot longer access the data. Panic mode on!
Shares can be rebuilt but maybe user_A has created a complex structure with multiples circles, permissions settings… So my solution is, before leaving circle, user_A names a new admin of circle (userB) and transfers shares ownership (directly from the database) to the new admin (I did it by script). Obviously userB has to: be part of the subcircle_projectX and be allowed to share projectX folder (as user of the group folder for example)
The preconditions seem clear but from the DB perspective I want to ensure that is as simple as ONLY modify records of share table changing uid_initiator from the old user uid to the new admin uid.
update_query="UPDATE oc_share s
SET **s.uid_initiator='$uid_new_admin'**
WHERE **s.uid_initiator='$uid_old_admin'**
AND s.share_with='$selected_circle_id';"
(it has to be refined in order to include only records owned to the group folder, not private resources, but this is the idea)
This is a right approach? Currently I have a functional script that I’m polishing in order to be resilient, but it seems to work fine.