Hi Chris,

As we were discussing on IRC, I was looking into the bug
"menu_generate() too sensitive to non-existing roles" (
https://sourceforge.net/tracker/?func=detail&aid=3445575&group_id=175965&atid=875350
).

So far, I see three solutions, some of which we already discussed on IRC:

1. Create a wrapper function around pg_has_role() which doesn't call
pg_has_role() when the role doesn't exist
2. Create a view which can be used in place of menu_acl -- filtered
for all roles which exist
3. Put the filter criteria straight into the menu_generate() and
menu_children() functions
4. Do nothing, but when we build functionality to load add-ons into
setup.pl, have that verify the validity of any adjustments to the menu
before completion

Since you seemed to prefer (2), I've been looking into that.
Unfortunately, the query optimizer seems to re-order things so that
the pg_has_role() function gets called on all records in menu_acl,
only to filter the resulting set against roles in pg_roles. By then,
the damage has been done. It seems this isn't an option after all.

Option (3) suffers from the same problem as option (2). So, that too
isn't an option.

Remain options (4) and (1) which I prefer in exactly that order. I
wouldn't expect a huge performance issue from the wrapper, since the
rolname column is indexed with a btree index. So, looking up will only
mean a few iterations through the index. However, verifying validity
of the menu only once seems a much better solution: why verify
something that's nearly always going to be exactly as expected?

So, that's why I prefer option (4). I think we should close the ticket
and add this to a feature request for setup.pl.

What do you say?


Bye,


Erik.

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Ledger-smb-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel

Reply via email to