List:Eventum Development« Previous MessageNext Message »
From:M  IN BLR SISL Srivathsan Date:September 24 2009 10:14am
Subject:Seems to be a bug in User::getRoleID()
View as plain text  
Hi all,

Just wanted to confirm whether my assessment is right or wrong

In the method User::getRoleID($role_title), the global variable $roles is used.  From the
other portions of code in class.user.php, I understand that other role-related methods
like User::getRole() and User::getRoles(), $GLOBALS['localized_roles'] is used.

I feel that User::getRoleID() should also use $GLOBALS['localized_roles'] instead of
$roles that contains only untranslated role titles.  I wrote a code as part of my
workflow engine wherein I am comparing the role id of user to that of a Reporter.  So I
wrote 'if ($usr_role_id == User::getRoleID(ev_gettext('Reporter')))'.  In my
implementation of eventum, 'Reporter' is translated as 'Employee'.  So, the method
User::getRoleID(ev_gettext('Reporter'))) just returns a NULL as there is no role title
'Employee' in the $roles array but is there in $GLOBALS['localized_roles'].

Could anyone confirm / explain why User::getRoleID() method is not referring to
$GLOBALS['localized_roles'] - any good reason?

Thanks and rgds,
Watson


Thread
Seems to be a bug in User::getRoleID()M  IN BLR SISL Srivathsan24 Sep