new_permission_model
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
new_permission_model [2007/04/26 19:23] – rearranged the ordering a bit. pizza | new_permission_model [2007/04/26 19:45] (current) – rewrote the last part. pizza | ||
---|---|---|---|
Line 157: | Line 157: | ||
The goal of this migration is to transform all existing permissions to the new model. | The goal of this migration is to transform all existing permissions to the new model. | ||
- | == Set things up == | + | === Set things up === |
- | | + | |
- | + | | |
- | | + | |
- | + | | |
- | INSERT INTO groups(identifier, | + | |
- | | + | |
- | + | ||
- | INSERT INTO group_memberships(group_id, | + | |
- | | + | |
- | FROM users u, user_type t | + | |
- | WHERE u.type = t.identifier | + | |
- | AND t.value = ' | + | |
- | + | ||
- | | + | |
- | + | ||
- | | + | |
- | | + | |
- | + | ||
- | * Create group 2, " | + | |
- | + | ||
- | INSERT INTO groups(identifier, | + | |
- | | + | |
- | + | ||
- | INSERT INTO group_memberships(group_id, | + | |
- | | + | |
- | FROM users u; | + | |
| | ||
- | == The following list needs to be repeated for each user == | + | === The following list needs to be repeated for each user === |
- | | + | |
- | | + | |
- | $_grp_id = SELECT nextval(groups_sequence); | + | |
- | + | | |
- | INSERT INTO groups(identifier, | + | |
- | | + | |
- | INSERT INTO group_memberships(group, user) | + | |
- | | + | |
- | + | ||
- | * Update ownerships to point to the new group: | + | |
- | + | ||
- | UPDATE folder f | + | |
- | SET f.owner = $_grp_id | + | |
- | WHERE f.users = $_user_id; | + | |
- | + | ||
- | UPDATE album a | + | |
- | SET a.owner = $_grp_id | + | |
- | WHERE a.users = $_user_id; | + | |
- | | + | |
- | UPDATE photo p | + | |
- | SET p.owner = $_grp_id | + | |
- | WHERE p.users = $_user_id; | + | |
- | + | ||
- | * Create a new group called | + | |
- | + | ||
- | INSERT INTO groups(identifier, | + | |
- | | + | |
- | INSERT INTO group_memberships(group_id, | + | |
- | | + | |
- | FROM clients c | + | |
- | WHERE c.users = $_userid; | + | |
- | + | ||
- | | + | |
== For each folder == | == For each folder == | ||
- | | + | |
- | + | | |
- | INSERT INTO folder_permissions (folder, group_id, edit, caption, delete, list, modify) | + | |
- | | + | |
- | + | ||
- | | + | |
- | + | ||
- | | + | |
- | + | ||
- | | + | |
- | | + | |
- | + | ||
- | * if access_rights is public (ie everyone) | + | |
- | + | ||
- | INSERT INTO folder_permissions (folder, group_id, edit, caption, delete, list, modify) | + | |
- | | + | |
== For each album: == | == For each album: == | ||
- | | + | |
- | + | | |
- | | + | |
- | | + | |
- | + | ||
- | * if access_rights is private, stop here. | + | |
- | + | ||
- | | + | |
- | + | ||
- | | + | |
- | | + | |
- | + | ||
- | * if access_rights is public (ie everyone) | + | |
- | + | ||
- | INSERT INTO album_permissions (album, group_id, edit, caption, delete, list, modify) | + | |
- | | + | |
== For each photo: == | == For each photo: == | ||
- | | + | |
- | + | | |
- | | + | |
- | | + | |
- | + | ||
- | * If access_rights is private, stop here. | + | |
- | + | ||
- | * If access_rights is protected (ie clients only): | + | |
- | + | ||
- | | + | |
- | | + | |
- | + | ||
- | * If access_rights is public (ie guest access): | + | |
- | + | ||
- | | + | |
- | | + | |
- | //Note2: | + | //Note -- the 'hide_original' |
- | == Finally == | + | === Finally |
- | - Drop all necessary | + | - Drop all obseleted |
- | - ??? | + | |
- | - Profit | + | |
- | ==== Source Hax0r (in rough order) | + | ==== Roadmap |
- Schema finalization | - Schema finalization | ||
- Migration code for installer | - Migration code for installer | ||
- | - Write PL/pgsql permission lookup code | + | - Write PL/pgsql permission lookup code and any necessary triggers. |
- | - Port account registration auto-create groups, etc) | + | - Define default permission sets for new users and new folders/ |
- | - Port photo view/ | + | - Port account |
- | - Port folder/ | + | - Port admin pages (account status, etc) |
+ | - Port photo & version import pages | ||
+ | - Port photo view/ | ||
+ | - Port folder/ | ||
- Port folder/ | - Port folder/ | ||
- | - Port photo import/ | ||
- Port bulk update | - Port bulk update | ||
- | - Create Group UI elements | + | - Create Group management |
- | - Create Permission UI elements (for photo add and bulk update too!) | + | - Create Permission |
- Port over equipment/ | - Port over equipment/ |
new_permission_model.txt · Last modified: 2007/04/26 19:45 by pizza