Package org.jasig.portal.layout.dlm.remoting

Examples of org.jasig.portal.layout.dlm.remoting.JsonEntityBean


         * possible that this implementation would demonstrate inconsistent
         * behavior.
         */
       
        for (String type : allowedEntityTypes) {
            JsonEntityBean entity = groupListHelper.getEntity(type, key, false);
            if (entity != null) {
                String entityId = entity.getId();
                if("portlet".equals(type))
                    entityId = IPermission.PORTLET_PREFIX.concat(entityId);
                IPermissionTarget target = new PermissionTargetImpl(entityId, entity.getName());
                return target;
            }
        }
       
        return null;
View Full Code Here


  public JsonEntityBean findEntity(HttpServletRequest request,
      HttpServletResponse response,
      @PathVariable("entityType") String entityType,
      @PathVariable("entityId") String entityId) {

    final JsonEntityBean result = groupListHelper.getEntity(entityType, entityId, true);
    return result;

  }
View Full Code Here

        }
        return null;
    }
   
    protected AuthorizableActivity getViewActivity(final String activityKey, final String target) {
        final JsonEntityBean entity = groupListHelper.getEntityForPrincipal(target);
        return getViewActivity(activityKey, entity);
    }
View Full Code Here

    // add child groups to our group form bean
    @SuppressWarnings("unchecked")
    Iterator<IGroupMember> groupIter = (Iterator<IGroupMember>) group.getMembers();
    while (groupIter.hasNext()) {
      IGroupMember child = groupIter.next();
      JsonEntityBean childBean = groupListHelper.getEntity(child);
      form.addMember(childBean);
    }
   
    return form;
  }
View Full Code Here

   
    @PreAuthorize("hasPermission('string', 'ALL', new org.jasig.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))")
    @RequestMapping("/assignments/principal/{principal}.json")
    public ModelAndView getAssignmentsForPrincipal(@PathVariable("principal") String principal, @RequestParam(value="includeInherited", required = false) boolean includeInherited, HttpServletRequest request, HttpServletResponse response) {
       
        JsonEntityBean entity = groupListHelper.getEntityForPrincipal(principal);
        List<JsonPermission> permissions = getPermissionsForEntity(entity, includeInherited);

        ModelAndView mv = new ModelAndView();
        mv.addObject("assignments", permissions);
        mv.setViewName("json");
View Full Code Here

   
    @PreAuthorize("(#entityType == 'person' and #id == authentication.name) or hasPermission('string', 'ALL', new org.jasig.portal.spring.security.evaluator.AuthorizableActivity('UP_PERMISSIONS', 'VIEW_PERMISSIONS'))")
    @RequestMapping("/assignments/{entityType}/{id}.json")
    public ModelAndView getAssignmentsForEntity(@PathVariable("entityType") String entityType, @PathVariable("id") String id, @RequestParam(value="includeInherited", required = false) boolean includeInherited, HttpServletRequest request, HttpServletResponse response) {
       
        JsonEntityBean entity = groupListHelper.getEntity(entityType, id, false);
        List<JsonPermission> permissions = getPermissionsForEntity(entity, includeInherited);

        ModelAndView mv = new ModelAndView();
        mv.addObject("assignments", permissions);
        mv.setViewName("json");
View Full Code Here

        IPermission[] directPermissions = permissionStore.select(null, null, null, target, null);
        for (IPermission permission : directPermissions) {
            directAssignments.add(new UniquePermission(permission.getOwner(), permission.getActivity(), permission.getPrincipal(), false));
        }

        JsonEntityBean entity = groupListHelper.getEntityForPrincipal(target);
        IAuthorizationPrincipal p = this.authorizationService.newPrincipal(entity.getId(), entity.getEntityType().getClazz());
       
        Set<UniquePermission> inheritedAssignments = new HashSet<UniquePermission>();
        if (includeInherited) {
            IGroupMember member = GroupService.getGroupMember(p.getKey(), p.getType());
            for (Iterator<IEntityGroup> iter = member.getAllContainingGroups(); iter.hasNext();) {
                IEntityGroup parent = iter.next();

                IAuthorizationPrincipal parentPrincipal = this.authorizationService.newPrincipal(parent);
                IPermission[] parentPermissions = permissionStore.select(null, null, null, parentPrincipal.getKey(), null);
                for (IPermission permission : parentPermissions) {
                    inheritedAssignments.add(new UniquePermission(permission.getOwner(), permission.getActivity(), permission.getPrincipal(), true));
                }
            }
        }
       
        List<JsonPermission> permissions = new ArrayList<JsonPermission>();
       
        for (UniquePermission permission : directAssignments) {
            JsonEntityBean e = groupListHelper.getEntityForPrincipal(permission.getIdentifier());
            Class<?> clazz;
            EntityEnum entityType = EntityEnum.getEntityEnum(e.getEntityTypeAsString());
            if (entityType.isGroup()) {
                clazz = IEntityGroup.class;
            } else {
                clazz = entityType.getClazz();
            }
            IAuthorizationPrincipal principal = this.authorizationService.newPrincipal(e.getId(), clazz);
            if (principal.hasPermission(permission.getOwner(), permission.getActivity(), p.getKey())) {
                permissions.add(getPermissionOnTarget(permission, entity));
            }
        }

        for (UniquePermission permission : inheritedAssignments) {
            JsonEntityBean e = groupListHelper.getEntityForPrincipal(permission.getIdentifier());
            Class<?> clazz;
            EntityEnum entityType = EntityEnum.getEntityEnum(e.getEntityTypeAsString());
            if (entityType.isGroup()) {
                clazz = IEntityGroup.class;
            } else {
                clazz = entityType.getClazz();
            }
            IAuthorizationPrincipal principal = this.authorizationService.newPrincipal(e.getId(), clazz);
            if (principal.hasPermission(permission.getOwner(), permission.getActivity(), p.getKey())) {
                permissions.add(getPermissionOnTarget(permission, entity));
            }
        }
        Collections.sort(permissions);
View Full Code Here

                perm.setActivityName(activity.getName());
            } else {
                perm.setActivityName(permission.getActivity());
            }
           
            JsonEntityBean principal = groupListHelper.getEntityForPrincipal(permission.getIdentifier());
            if (principal != null) {
                perm.setPrincipalKey(principal.getId());
                perm.setPrincipalName(principal.getName());
            }
           
        } catch (RuntimeException e) {
            log.warn("Exception while adding permission", e);
        }
View Full Code Here

TOP

Related Classes of org.jasig.portal.layout.dlm.remoting.JsonEntityBean

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.