Package org.osforce.connect.web.security.annotation

Examples of org.osforce.connect.web.security.annotation.Permission


    WidgetConfig widgetConfig = (WidgetConfig) request.getAttribute(WidgetConfig.KEY) ;
    if(widgetConfig!=null) {
      Project project = (Project) request.getAttribute(PROJECT_KEY);
      User user = (User) request.getAttribute(USER_KEY);
      String requestPath = widgetConfig.getPath();
      Permission permission = permissionMappings.get(requestPath);
      if(permission!=null) {
        // validate user
        if(permission.userRequired() && user==null) {
          return false;
        }
        // validate project
        if(permission.projectRequired() && project==null) {
          return false;
        }
        // validate resource
        String[] resources = permission.value();
        return permissionService.hasPermission(project, user, resources);
      }
    }
    return true;
  }
View Full Code Here


        while(iter.hasNext()) {
          Method method = iter.next();
          RequestMapping methodRequestMapping = AnnotationUtils.findAnnotation(method, RequestMapping.class);
          String[] paths = methodRequestMapping.value();
          List<String> mappingPaths = buildMappingPaths(namespaces, paths);
          Permission permission = AnnotationUtils.findAnnotation(method, Permission.class);
          for(String mappingPath : mappingPaths) {
            permissionMappings.put(mappingPath, permission);
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.osforce.connect.web.security.annotation.Permission

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.