Package org.opencustomer.framework.db.vo

Examples of org.opencustomer.framework.db.vo.EntityAccess


    {
        return checkEditable(request, (EditPanel)Panel.getPanelStack(request).peek());
    }
   
    public static boolean checkEditable(HttpServletRequest request, EditPanel panel) {
        EntityAccess entityAccess = null;
        if(panel.getEntity() instanceof EntityAccess) {
            entityAccess = (EntityAccess)panel.getEntity();
        }
       
        return checkEditable(request, panel, entityAccess);
View Full Code Here


            Object obj = TagUtils.getInstance().lookup(pageContext, name, property, scope);
           
            if(obj instanceof EntityAccess)
            {
                EntityAccess entity = (EntityAccess)obj;
                if (EntityAccessUtility.isAccessGranted(user, entity, access))
                    hasAccess = true;
            }
            else
            {
View Full Code Here

    {
        UserVO user            = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
        EventVO event          = (EventVO) panel.getAttribute("event");
        CalendarVO calendar    = (CalendarVO) panel.getAttribute("calendar");
       
        EntityAccess testEntity = null;
        if (event.getId() == null)
            testEntity = calendar;
        else {
            EventCalendarVO myEventCalendar = null;
           
View Full Code Here

    {
        UserVO activeUser = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
       
        EditPanel panel = getPanel();
       
        EntityAccess ea = getEntityAccess(request);
       
        if(panel.getAttribute("system_entityAccess") == null) {
            panel.setAttribute("system_entityAccess", ea);

            List<UsergroupVO> usergroups = new UsergroupDAO().getList(null, UsergroupDAO.AdminSelect.ALL, new Sort(UsergroupDAO.SORT_NAME, true), null, activeUser);
           
            // load a set usergroup where you do not have rights
            boolean usergroupAccess = false;
            for(UsergroupVO vo : usergroups) {
                if(ea.getOwnerGroup().equals(vo.getId())) {
                    usergroupAccess = true;
                    break;
                }
            }
            if(!usergroupAccess) {
                UsergroupVO vo = new UsergroupDAO().getById(ea.getOwnerGroup());
                usergroups.add(0, vo);
            }
            Collections.sort(usergroups, new Comparator<UsergroupVO>() {
                public int compare(UsergroupVO usergroup1, UsergroupVO usergroup2)
                {
                    return usergroup1.getName().compareTo(usergroup2.getName());
                }
            });           
            panel.setAttribute("system_usergroups", usergroups);
           
            if(ea != null) {
                UserVO user = (UserVO)request.getSession().getAttribute(Globals.USER_KEY);
               
                Page activePage = panel.getActivePage();
               
                activePage.setEditable(isEditable(panel, user, ea, request));
            }
           
            UserVO ownerUser = null;
   
            if(panel.getAttribute("system_ownerUser") == null && ea.getOwnerUser() > 0) {
                if(log.isDebugEnabled())
                    log.debug("load user for owner of entity access");
               
                ownerUser = new UserDAO().getById(ea.getOwnerUser());
                panel.setAttribute("system_ownerUser", ownerUser);
            }
           
            if(ea instanceof StampedVO) {
                StampedVO vo = (StampedVO)ea;
                panel.setAttribute("system_isStamped", Boolean.TRUE);
               
                if(panel.getAttribute("system_createUser") == null && vo.getCreateUser() != null && vo.getCreateUser() > 0) {
                    UserVO user = null;
                    if(vo.getCreateUser().equals(ea.getOwnerUser())) {
                        user = ownerUser;
                    } else {
                        user = new UserDAO().getById(vo.getCreateUser());
                    }
                    panel.setAttribute("system_createUser", user);
                }
   
                if(panel.getAttribute("system_modifyUser") == null && vo.getModifyUser() != null && vo.getModifyUser() > 0) {
                    UserVO user = null;
                    if(vo.getModifyUser().equals(ea.getOwnerUser())) {
                        user = ownerUser;
                    } else if(vo.getModifyUser().equals(vo.getCreateUser())) {
                        user = ownerUser;
                    } else {
                        user = new UserDAO().getById(vo.getModifyUser());
View Full Code Here

    }
   
    @Override
    public final void writeForm(E form, ActionMessages errors, HttpServletRequest request)
    {
        EntityAccess entity = getEntityAccess(request);

        form.setGlobalAccess(entity.getAccessGlobal().toString());
        form.setGroup(entity.getOwnerGroup());
        form.setGroupAccess(entity.getAccessGroup().toString());
    }
View Full Code Here

    }
   
    @Override
    public final void readForm(E form, ActionMessages errors, HttpServletRequest request)
    {
        EntityAccess entity = getEntityAccess(request);

        entity.setAccessGlobal(EnumUtility.valueOf(EntityAccess.Access.class, form.getGlobalAccess()));
        entity.setOwnerGroup(form.getGroup());
        entity.setAccessGroup(EnumUtility.valueOf(EntityAccess.Access.class, form.getGroupAccess()));
    }
View Full Code Here

        }
       
        if(getEntityAccess(request) != null)
        {
            UserVO user = (UserVO)request.getSession().getAttribute(Globals.USER_KEY);
            EntityAccess entity = getEntityAccess(request);
            TestEntityAccess test = new TestEntityAccess(entity);
            test.setAccessGlobal(EnumUtility.valueOf(EntityAccess.Access.class, globalAccess));
            test.setAccessGroup(EnumUtility.valueOf(EntityAccess.Access.class, groupAccess));
            test.setOwnerGroup(group);
           
View Full Code Here

TOP

Related Classes of org.opencustomer.framework.db.vo.EntityAccess

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.