Examples of ACL


Examples of hudson.security.ACL

        protected Permission getPermission() {
            return Permission.READ;
        }

        protected ACL getACL() {
            return new ACL() {
                public boolean hasPermission(Authentication a, Permission permission) {
                     return true;
                }
            };
        }
View Full Code Here

Examples of hudson.security.ACL

    static {
        XSTREAM.alias("user",User.class);
    }

    public ACL getACL() {
        final ACL base = Jenkins.getInstance().getAuthorizationStrategy().getACL(this);
        // always allow a non-anonymous user full control of himself.
        return new ACL() {
            public boolean hasPermission(Authentication a, Permission permission) {
                return (a.getName().equals(id) && !(a instanceof AnonymousAuthenticationToken))
                        || base.hasPermission(a, permission);
            }
        };
    }
View Full Code Here

Examples of lotus.domino.ACL

  @SuppressWarnings("unchecked")
  private List<String> getUserRoles(String user) {
    List<String> roles = null;
    Database db = ExtLibUtil.getCurrentDatabase();
    try {
      ACL acl = db.getACL();
      if (acl != null) {
        ACLEntry entry = acl.getEntry(user);
        if (entry != null) {
          roles = (List<String>)entry.getRoles();
          entry.recycle();
        }
        acl.recycle();
      }
    }
    catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

Examples of loxia.web.annotation.Acl

   
    OperatingUnitDao operatingUnitDao = (OperatingUnitDao)ctx.getBean("loxiaOperatingUnitDao");
   
    String strMethod = invocation.getProxy().getMethod();
    Method m = getActionMethod(action.getClass(), strMethod);
    Acl acl = m.getAnnotation(Acl.class);
    if(acl == null)
      acl = action.getClass().getAnnotation(Acl.class);
       
    boolean needCheck = true;
    boolean needCredential = true;
    if(acl == null){
      needCheck = false;
      needCredential = false;
    }else if(acl.value().length == 0
        || Arrays.asList(acl.value()).contains(""))
      needCheck = false;
    if(logger.isDebugEnabled()){
      if(needCredential)
        logger.debug("Credential is required.");
      logger.debug("Current ACL:{}", needCheck ? acl : "");
    }
   
    Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
   
    if(needCredential && authentication == null){
      logger.error("Session timeout.");
      throw new BusinessException(PreserveErrorCode.SESSION_TIMEOUT);
    }
   
    if(needCheck){
      BaseProfileAction act = (BaseProfileAction)action;
                 
      LoxiaUserDetails userDetails = (LoxiaUserDetails)authentication.getPrincipal();
      logger.debug("Current Principal:" + userDetails);
      String entryAcl = act.getAcl();
      if(entryAcl != null){
        userDetails.setCurrentOu(null);
        logger.debug("Function Entrance... Organization need to repick");
       
        for(GrantedAuthority auth: userDetails.getAuthorities()){
          LoxiaGrantedAuthority lauth = (LoxiaGrantedAuthority)auth;
          if(lauth.getAuthority().equals(entryAcl)){
            userDetails.setCurrentAuthority(lauth);
            break;
          }
        }
        if(userDetails.getCurrentAuthority() == null ||
            userDetails.getCurrentAuthority().getOuIds().size() == 0){
          logger.error("No sufficicent privilege.");
          throw new BusinessException(PreserveErrorCode.NO_SUFFICICENT_PRIVILEGE);
        }else{
          if(userDetails.getCurrentAuthority().
              getOuIds().size() == 1){
            userDetails.setCurrentOu(operatingUnitDao.getByPrimaryKey(
                userDetails.getCurrentAuthority().getOuIds().iterator().next()));
          }else{
            logger.debug("Redirect Invocation");
           
            String url = request.getRequestURI();
            Enumeration<String> paramNames = request.getParameterNames();
            StringBuffer paramsSb = new StringBuffer();
            while (paramNames.hasMoreElements()) {
              String name = (String) paramNames.nextElement();
              if (!"acl".equalsIgnoreCase(name)){
                paramsSb.append(name + "=" + request.getParameter(name) + "&");
              }
            }
            if (paramsSb.length() > 0){
              paramsSb.deleteCharAt(paramsSb.length()-1);
              url = url + "?" + paramsSb.toString();
            }
            request.getSession().setAttribute(BaseAction.FOLLOWING_URL_AFTER_OPERATING_UNIT_PICKUP, url);
            response.sendRedirect(request.getContextPath() + "/operatingunitpickup.do");
            return null;
          }
        }
      }else{
        if(act.getSelectedOuId() != null){
          //set Current OperatingUint in up
          userDetails.setCurrentOu(operatingUnitDao.getByPrimaryKey(act.getSelectedOuId()));
        }else{
          if(!userDetails.checkAuthority(acl.value())){
            logger.error("No sufficicent privilege.");
            throw new BusinessException(PreserveErrorCode.NO_SUFFICICENT_PRIVILEGE);
          }
        }         
      }
View Full Code Here

Examples of loxia.web.annotation.Acl

      logger.info("Currently we only check privilege on controllers.");
      return pjp.proceed(pjp.getArgs());
    }
   
    MethodSignature ms = (MethodSignature)pjp.getSignature();
    Acl acl = ms.getMethod().getAnnotation(Acl.class);
   
    logger.debug("Acl found: {}", Arrays.asList(acl.value()));
    OperatingUnitDao operatingUnitDao = (OperatingUnitDao)context.getBean("loxiaOperatingUnitDao");
    OperatingUnit currentOu = null;
    Annotation[][] paramAnnos = ms.getMethod().getParameterAnnotations();
    for(int i=0; i < paramAnnos.length; i++){
      for(int j=0; j< paramAnnos[i].length; j++){
        if(paramAnnos[i][j] != null && paramAnnos[i][j] instanceof CurrentOu){
          Long ouId = null;
          if(pjp.getArgs()[i] instanceof OperatingUnit){
            ouId = ((OperatingUnit)pjp.getArgs()[i]).getId();
          }else if(pjp.getArgs()[i] instanceof Long){
            ouId = (Long)pjp.getArgs()[i];
          }else
            throw new IllegalArgumentException("Current Ou setting error.");
          if(ouId != null)
            currentOu = operatingUnitDao.getByPrimaryKey(ouId);
          if(currentOu == null)
            throw new IllegalArgumentException("Current Ou is null.");
          break;
        }
      }
      if(currentOu != null) break;
    }     
         
    if(currentOu != null){
      logger.debug("New current ou is set:{}[{}]", currentOu.getName(), currentOu.getId());
      controller.setCurrentOperatingUnit(currentOu);
    }else{
      logger.debug("Current ou isn't changed.");
    }
   
    if(controller.getCurrentOperatingUnit() == null){
      logger.warn("Current ou is null.");
      throw new BusinessException(PreserveErrorCode.NO_SUFFICICENT_PRIVILEGE);
    }
    if(controller.checkPrivilege(acl.value())){
      logger.debug("User pass the authorization.");
      return pjp.proceed(pjp.getArgs());
    }else{
      throw new BusinessException(PreserveErrorCode.NO_SUFFICICENT_PRIVILEGE);
    }
View Full Code Here

Examples of org.acegisecurity.acls.Acl

        Sid[] sids = sidRetrievalStrategy.getSids(SecurityContextHolder.getContext().getAuthentication());
        ObjectIdentity oid = objectIdentityRetrievalStrategy.getObjectIdentity(resolvedDomainObject);

        // Obtain aclEntrys applying to the current Authentication object
        try {
            Acl acl = aclService.readAclById(oid, sids);

            if (acl.isGranted(requiredPermissions, sids, false)) {
                return Tag.EVAL_BODY_INCLUDE;
            } else {
                return Tag.SKIP_BODY;
            }
        } catch (NotFoundException nfe) {
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.data.Acl

    }

    private String createDocument(String name, String folderId, String typeId, Map<String, Object> properties,
            VersioningState verState, ContentStream contentStream) {
        List<String> policies = null;
        Acl addACEs = null;
        Acl removeACEs = null;
        ExtensionsData extension = null;

        Properties props = createDocumentProperties(name, typeId, properties);

        String id = null;
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.data.Acl

        String objectId = getObjectId();
        return getBinding().getAclService().getAcl(getRepositoryId(), objectId, onlyBasicPermissions, null);
    }

    public Acl applyAcl(List<Ace> addAces, List<Ace> removeAces, AclPropagation aclPropagation) {
        Acl result = getSession().applyAcl(this, addAces, removeAces, aclPropagation);

        refresh();

        return result;
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.data.Acl

    }

    public Acl createAcl(List<Ace> aces) {
        BindingsObjectFactory bof = getBindingsObjectFactory();

        Acl acl = bof.createAccessControlList(aces);

        return acl;
    }
View Full Code Here

Examples of org.apache.chemistry.opencmis.commons.data.Acl

        ChangeType changeType = null;
        GregorianCalendar changeTime = null;
        String objectId = null;
        Map<String, List<?>> properties = null;
        List<String> policyIds = null;
        Acl acl = null;

        if (objectData.getChangeEventInfo() != null) {
            changeType = objectData.getChangeEventInfo().getChangeType();
            changeTime = objectData.getChangeEventInfo().getChangeTime();
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.