All pastes #83410 Raw Edit

Someone

public text v1 · immutable
·published 2006-07-09 19:39 UTC
rendered paste body
1. Normalize permissions.

user.module:357:    $result = db_query("SELECT DISTINCT(p.perm) FROM {role} r INNER JOIN {permission} p ON p.rid = r.rid WHERE r.rid IN (%s)", implode(',', array_keys($account->roles)));
user.module:1745:    $result = db_query("SELECT r.* FROM {role} r INNER JOIN {permission} p ON r.rid = p.rid WHERE p.perm LIKE '%%%s%%' ORDER BY r.name", $permission);
user.module:1771:    $result = db_query('SELECT r.rid, p.perm FROM {role} r LEFT JOIN {permission} p ON r.rid = p.rid WHERE r.rid IN (%s) ORDER BY name', implode(', ', $rids));
user.module:1774:    $result = db_query('SELECT r.rid, p.perm FROM {role} r LEFT JOIN {permission} p ON r.rid = p.rid ORDER BY name');
user.module:1861:      db_query('DELETE FROM {permission} WHERE rid = %d', $role->rid);
user.module:1868:        db_query("INSERT INTO {permission} (rid, perm) VALUES (%d, '%s')", $role->rid, implode(', ', array_keys($edit[$role->rid])));
user.module:1900:    db_query('DELETE FROM {permission} WHERE rid = %d', $id);

2. create three tables: menu (mid, arg0, arg1, arg2, arg3, arg4, arg5) , menu_allow(mid, pid), menu_deny(mid, pid)

SELECT mid WHERE arg0 IN ('%s', '/') && arg1 IN ('%s', '/')... FROM menu m LEFT JOIN menu_allow ma ON m.mid = ma.mid LEFT JOIN menu_deny ON m.mid = md.mid WHERE md.pid IS NULL OR ma.pid IS NOT NULL 

of course, this needs to be checked againt the permissions of the user but for introduction this is enough.