Package org.jboss.seam.annotations.security

Examples of org.jboss.seam.annotations.security.Restrict


               Restriction restriction = null;
              
               Method method = getComponent().getBeanClass().getMethod(
                     interfaceMethod.getName(), interfaceMethod.getParameterTypes() );     
              
               Restrict restrict = null;
              
               if ( method.isAnnotationPresent(Restrict.class) )
               {
                  restrict = method.getAnnotation(Restrict.class);
               }
               else if ( getComponent().getBeanClass().isAnnotationPresent(Restrict.class) )
               {
                  if ( !getComponent().isLifecycleMethod(method) )
                  {
                     restrict = getComponent().getBeanClass().getAnnotation(Restrict.class);
                  }
               }
              
               if (restrict != null)
               {
                  if (restriction == null) restriction = new Restriction();
                 
                  if ( Strings.isEmpty(restrict.value()) )
                  {
                     restriction.setPermissionTarget(getComponent().getName());
                     restriction.setPermissionAction(method.getName());
                  }
                  else
                  {
                     restriction.setExpression(restrict.value());
                  }
               }
              
               for (Annotation annotation : method.getDeclaringClass().getAnnotations())
               {
View Full Code Here


               Restriction restriction = null;
              
               Method method = getComponent().getBeanClass().getMethod(
                     interfaceMethod.getName(), interfaceMethod.getParameterTypes() );     
              
               Restrict restrict = null;
              
               if ( method.isAnnotationPresent(Restrict.class) )
               {
                  restrict = method.getAnnotation(Restrict.class);
               }
               else if ( getComponent().getBeanClass().isAnnotationPresent(Restrict.class) )
               {
                  if ( !getComponent().isLifecycleMethod(method) )
                  {
                     restrict = getComponent().getBeanClass().getAnnotation(Restrict.class);
                  }
               }
              
               if (restrict != null)
               {
                  if (restriction == null) restriction = new Restriction();
                 
                  if ( Strings.isEmpty(restrict.value()) )
                  {
                     restriction.setPermissionTarget(getComponent().getName());
                     restriction.setPermissionAction(method.getName());
                  }
                  else
                  {
                     restriction.setExpression(restrict.value());
                  }
               }
              
               for (Annotation annotation : method.getDeclaringClass().getAnnotations())
               {
View Full Code Here

               break;
            case DELETE:
               m = provider.getPreRemoveMethod(entity, getEntityManager());
         }
        
         Restrict restrict = null;
        
         if (m != null && m.isAnnotationPresent(Restrict.class))
         {
            restrict = m.getAnnotation(Restrict.class);
         }
         else if (entity.getClass().isAnnotationPresent(Restrict.class))
         {
            restrict = entity.getClass().getAnnotation(Restrict.class);
         }

         if (restrict != null)
         {
            if (Strings.isEmpty(restrict.value()))
            {
               identity.checkPermission(entity, action.toString());
            }
            else
            {
               identity.checkRestriction(restrict.value());
            }
         }
      }
   } 
View Full Code Here

      {
         for (Annotation annotation : cls.getAnnotations())
         {
            if (annotation instanceof Restrict)
            {
               Restrict restrict = (Restrict) annotation;
               if (restrictions == null) restrictions = new HashSet<String>();
              
               if ( Strings.isEmpty(restrict.value()) )
               {
                  throw new IllegalStateException("@Restrict on " + cls.getName() + " must specify an expression");
               }
              
               restrictions.add(restrict.value());
            }
           
            if (annotation.annotationType().isAnnotationPresent(RoleCheck.class))
            {
               if (restrictions == null) restrictions = new HashSet<String>();
View Full Code Here

               Restriction restriction = null;
              
               Method method = getComponent().getBeanClass().getMethod(
                     interfaceMethod.getName(), interfaceMethod.getParameterTypes() );     
              
               Restrict restrict = null;
              
               if ( method.isAnnotationPresent(Restrict.class) )
               {
                  restrict = method.getAnnotation(Restrict.class);
               }
               else if ( getComponent().getBeanClass().isAnnotationPresent(Restrict.class) )
               {
                  if ( !getComponent().isLifecycleMethod(method) )
                  {
                     restrict = getComponent().getBeanClass().getAnnotation(Restrict.class);
                  }
               }
              
               if (restrict != null)
               {
                  if (restriction == null) restriction = new Restriction();
                 
                  if ( Strings.isEmpty(restrict.value()) )
                  {
                     restriction.setPermissionTarget(getComponent().getName());
                     restriction.setPermissionAction(method.getName());
                  }
                  else
                  {
                     restriction.setExpression(restrict.value());
                  }
               }
              
               for (Annotation annotation : method.getDeclaringClass().getAnnotations())
               {
View Full Code Here

               Restriction restriction = null;
              
               Method method = getComponent().getBeanClass().getMethod(
                     interfaceMethod.getName(), interfaceMethod.getParameterTypes() );     
              
               Restrict restrict = null;
              
               if ( method.isAnnotationPresent(Restrict.class) )
               {
                  restrict = method.getAnnotation(Restrict.class);
               }
               else if ( getComponent().getBeanClass().isAnnotationPresent(Restrict.class) )
               {
                  if ( !getComponent().isLifecycleMethod(method) )
                  {
                     restrict = getComponent().getBeanClass().getAnnotation(Restrict.class);
                  }
               }
              
               if (restrict != null)
               {
                  if (restriction == null) restriction = new Restriction();
                 
                  if ( Strings.isEmpty(restrict.value()) )
                  {
                     restriction.setPermissionTarget(getComponent().getName());
                     restriction.setPermissionAction(method.getName());
                  }
                  else
                  {
                     restriction.setExpression(restrict.value());
                  }
               }
              
               for (Annotation annotation : method.getDeclaringClass().getAnnotations())
               {
View Full Code Here

               break;
            case DELETE:
               m = provider.getPreRemoveMethod(entity, getEntityManager());
         }
        
         Restrict restrict = null;
        
         if (m != null && m.isAnnotationPresent(Restrict.class))
         {
            restrict = m.getAnnotation(Restrict.class);
         }
         else if (entity.getClass().isAnnotationPresent(Restrict.class))
         {
            restrict = entity.getClass().getAnnotation(Restrict.class);
         }

         if (restrict != null)
         {
            if (Strings.isEmpty(restrict.value()))
            {
               identity.checkPermission(entity, action.toString());
            }
            else
            {
               identity.checkRestriction(restrict.value());
            }
         }
      }
   } 
View Full Code Here

               break;
            case DELETE:
               m = provider.getPreRemoveMethod(beanClass);
         }
        
         Restrict restrict = null;
        
         if (m != null && m.isAnnotationPresent(Restrict.class))
         {
            restrict = m.getAnnotation(Restrict.class);
         }
         else if (entity.getClass().isAnnotationPresent(Restrict.class))
         {
            restrict = entity.getClass().getAnnotation(Restrict.class);
         }

         if (restrict != null)
         {
            if (Strings.isEmpty(restrict.value()))
            {
               checkPermission(name, action.toString(), entity);
            }
            else
            {
               checkRestriction(restrict.value());
            }
         }
      }
   }  
View Full Code Here

   {
      Method interfaceMethod = invocation.getMethod();
      //TODO: optimize this:
      Method method = getComponent().getBeanClass()
               .getMethod( interfaceMethod.getName(), interfaceMethod.getParameterTypes() );
      Restrict restrict = getRestriction(method);
     
      if ( restrict!=null && Identity.isSecurityEnabled() )
      {
         String expr = !Strings.isEmpty( restrict.value() ) ?
                  restrict.value() : createDefaultExpr(method);
         Identity.instance().checkRestriction(expr);
      }
      return invocation.proceed();
   }
View Full Code Here

    private static boolean
            isEntityRestricted(Object entity, EntityAction action) {
        EntityRestrict entityRestrict =
                entity.getClass().getAnnotation(EntityRestrict.class);
        Restrict restrict = entity.getClass().getAnnotation(Restrict.class);
        if (restrict != null) {
            if (entityRestrict != null) {
                if (Arrays.asList(entityRestrict.value()).contains(action)) {
                    return true; // restricted
                } else {
View Full Code Here

TOP

Related Classes of org.jboss.seam.annotations.security.Restrict

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.