• Tab rendering

    By Ingo Weidinger 1 decade ago

    Hi @all,

    something strange is happening with my tabs on some servers. Cannot really explain - will give it try.

    I am using the OneUILayout CC. Since the beginning I've defined several "titlebar Tabs". Some of them have a activated rendered option, which points to a function:

    function hasRole(strRole){
            var dbSigner:NotesDatabase = getSignerDB();
            var strRole:String = "[" + @Trim(strRole) + "]";
            var booRoleEnabled:Boolean = false;//default value
           
            var effectiveUserName = session.getEffectiveUserName();
            var entryACL:NotesACLEntry = dbSigner.getACL().getEntry(effectiveUserName);
           
            if(entryACL != null){
                booRoleEnabled = entryACL.isRoleEnabled(strRole);
            }
           
            return booRoleEnabled
    }

     

    This works perfect since about a year....

    Now, on some servers (not on all?!?!?) the rendered option of the tabs produce a "Failure 500" - not even the Default Failure Page is shown!. The failure does NOT occur in the function. The Tabs simply do not understand what to do with the return value. Also tried to return a simple string...

     

    Anyone an idea?

     

    Ingo

    • Re: hasRoles error

      By Tony McGuckin 1 decade ago

      The status 500 exception you are seeing could well be caused by your getSignerDB() method, or a null value being returned from this call.  You should wrap your code in a try/catch block and allow a safe return of false under an error condition.

      Assuming you are using the XLib, you should consider using the userBean instance to establish the presence of a role:

      ie: the userBean instance publishes the accessRoles property.

      therefore you could simply calculate as follows for example:

      return userBean.accessRoles.toString().contains("[Admin]");

      This will perform better as it is retrieved from the session based userBean instance, and should also avoid any unstability exposed by your original implementation.

      Hopefully this helps, as I'm not totaly convinced its a pure Tab Panel issue you are experiencing.