Details

    • Type: Task Task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.5.3
    • Fix Version/s: 1.6DR#1
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      all

      Description


      The following bean supports the syntax:

          rendered="#{role.ADMIN || role.USER}"


      import java.util.Map;
      import java.util.AbstractMap;
      import java.util.Set;

      public class RoleMap extends AbstractMap {

          public Object get(Object key) {
              FacesContext facesContext = FacesContext.getCurrentInstance();
              if (facesContext.getExternalContext()
                          .isUserInRole((String) key) ) {
                  return Boolean.TRUE;
              }

              return Boolean.FALSE;

          }

          public Set entrySet() {
              return null;
          }

      }

        Activity

        Hide
        Ted Goddard added a comment -

        Philip revised this to extend a different base collection class; Philip, could you paste your code in, state why you revised it, and then close?

        Show
        Ted Goddard added a comment - Philip revised this to extend a different base collection class; Philip, could you paste your code in, state why you revised it, and then close?
        Hide
        Ken Fyten added a comment -

        This is a test comment.

        Show
        Ken Fyten added a comment - This is a test comment.
        Hide
        Philip Breau added a comment -

        In my own testing, using an AbstractMap caused an exception on bean initialization (I forget what exact exception). Extending from a concrete HashMap solved the issue.

        import java.util.Map;
        import java.util.HashMap;
        import java.util.Set;
        import javax.faces.context.FacesContext;

        public class UserRoles extends HashMap {

        public Object get(Object key) {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        if (facesContext.getExternalContext()
        .isUserInRole((String) key) )

        { return Boolean.TRUE; }

        return Boolean.FALSE;
        }
        }

        Show
        Philip Breau added a comment - In my own testing, using an AbstractMap caused an exception on bean initialization (I forget what exact exception). Extending from a concrete HashMap solved the issue. import java.util.Map; import java.util.HashMap; import java.util.Set; import javax.faces.context.FacesContext; public class UserRoles extends HashMap { public Object get(Object key) { FacesContext facesContext = FacesContext.getCurrentInstance(); if (facesContext.getExternalContext() .isUserInRole((String) key) ) { return Boolean.TRUE; } return Boolean.FALSE; } }
        Hide
        Ken Fyten added a comment -

        This is an application code fix, not an ICEfaces product issue.

        Show
        Ken Fyten added a comment - This is an application code fix, not an ICEfaces product issue.

          People

          • Assignee:
            Philip Breau
            Reporter:
            Ted Goddard
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: