[geeklog-devel] Suggested new SEC_ functions
    Dirk Haun 
    dirk at haun-online.de
       
    Sun Oct  4 14:09:51 EDT 2009
    
    
  
Can I get some feedback on
<http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/aaa5a1f1850e>
please?
During development, I'm running Geeklog with error_reporting(E_ALL)
usually. That can be a bit of a pain in some situations, though. For
example, when saving an object and the perm_anon checkbox is not set,
you get an error when trying to access $_POST['perm_anon'].
So I came up with a helper function that filters the 6 standard
permission entries (owner_id, group_id, perm_owner, and so on), ensures
that they are all set and also does the translation from the array of
checkboxes to numerical values.
So now you could do something like
    $PERM = SEC_filterPermissions($_POST);
    if ($PERM['perm_anon'] == 0) { ...
without PHP throwing a fit when E_ALL is on but the perm_anon checkbox
wasn't checked.
And since one of the next steps usually involves passing all those
permission values to SEC_hasAccess, I came up with SEC_hasAccess2 (for
lack of a better idea for a name - suggestions welcome) which will do
the same but accept that $PERM array instead of 6 separate values.
Does anyone else think those functions could be useful? I've checked
them in but haven't started using them yet.
bye, Dirk
-- 
http://www.geeklog.net/
http://geeklog.info/
    
    
More information about the geeklog-devel
mailing list