Examples of Policy


Examples of com.adito.policyframework.Policy

        Resource resource = resourceType.getResourceById(Integer.parseInt(id));
        if(resource == null) {
            throw new Exception("No resource with ID " + id);
        }
        SessionInfo session = getSessionInfo(request);
        Policy policy = null;
        try {
          policy = LaunchSessionManager.getLaunchRequestPolicy(request, session, resource);
        } catch (Exception expt) {
          ActionMessages errs = new ActionMessages();
          errs.add(Globals.ERROR_KEY,  new BundleActionMessage("policyframework", "resourceNotAttachedToPolicy"));
          saveErrors(request, errs);
          return new RedirectWithMessages(returnTo, request);
        }
      Util.noCache(response);
        if(resource.sessionPasswordRequired(session)) {
            // Prompt for the session password then come back here
        return new ActionForward("/promptForSessionPassword.do?forwardTo=" +  Util.urlEncode(CoreUtil.getRealRequestURI(request) + "?resourceId=" + id + "&policy=" + policy.getResourceId() + "&returnTo=" + Util.urlEncode(returnTo)), true);
        }
        else {
            // Launch the agent and return here
          if(isAgentRequired(resource) && !DefaultAgentManager.getInstance().hasActiveAgent(request)) {
            return new ActionForward("/launchAgent.do?returnTo=" +  Util.urlEncode(CoreUtil.getRealRequestURI(request) + "?resourceId=" + id + "&policy=" + policy.getResourceId() + "&returnTo=" + Util.urlEncode(returnTo)), true);
          }
          else {
                LaunchSession launchSession = LaunchSessionFactory.getInstance().createLaunchSession(session, resource, policy);
                launchSession.checkAccessRights(null, session);
                try {
View Full Code Here

Examples of com.adito.policyframework.Policy

     */
    public void initialise(HttpServletRequest request, Policy resource, boolean editing, MultiSelectSelectionModel policyModel,
                           PropertyList selectedPolicies, User owner, boolean assignOnly) throws Exception {
        super.initialise(request, resource, editing, policyModel, selectedPolicies, owner, assignOnly);
        SessionInfo sessionInfo = LogonControllerFactory.getInstance().getSessionInfo(request);
        Policy pol = (Policy) resource;
        selectedAccounts = new PropertyList();
        selectedRoles = new PropertyList();
        List principals = PolicyDatabaseFactory.getInstance().getPrincipalsGrantedPolicy((Policy) resource, user.getRealm());
        for (Iterator i = principals.iterator(); i.hasNext();) {
            Principal p = (Principal) i.next();
View Full Code Here

Examples of com.adito.policyframework.Policy

                        AuthenticationScheme element = (DefaultAuthenticationScheme) iter.next();
                        if (!element.isSystemScheme() && element.getEnabled()) {
                            List attachedPolicies = PolicyDatabaseFactory.getInstance().getPoliciesAttachedToResource(element,
                                info.getUser().getRealm());
                            for (Iterator iterator = attachedPolicies.iterator(); iterator.hasNext();) {
                                Policy policy = (Policy) iterator.next();
                                if (!this.getResource().equals(policy)
                                                && PolicyDatabaseFactory.getInstance().isPolicyGrantedToUser(policy, getUser())) {
                                    found = true;
                                }
                            }
View Full Code Here

Examples of com.adito.policyframework.Policy

       * valid for this resource
       */
      if(isSuperUser(launchSession) || isLaunchSessionUsingValidPolicy(launchSession, resource)) {
        // It is, we can continue to use this launch session
            } else {
        Policy grantingPolicy = null;
       
        /* If the launch session already has policy, determine if this is a tracked session. If it is then don't allow
         * policy to change
         */
       
View Full Code Here

Examples of com.adito.policyframework.Policy

                    AuthenticationScheme element = (DefaultAuthenticationScheme) iter.next();
                    if (!element.isSystemScheme() && element.getEnabled()) {
                        List attachedPolicies = PolicyDatabaseFactory.getInstance().getPoliciesAttachedToResource(
                                        element, info.getUser().getRealm());
                        for (Iterator iterator = attachedPolicies.iterator(); iterator.hasNext();) {
                            Policy policy = (Policy) iterator.next();
                            // we don't check the current policy as it is about to be deleted.
                            if (policy.getResourceId() != this.selectedResource && PolicyDatabaseFactory.getInstance().isPolicyGrantedToUser(policy,
                                            info.getUser())) {
                                found = true;
                                break;
                            }
                        }
View Full Code Here

Examples of com.adito.policyframework.Policy

   *
   * @see com.adito.policyframework.PolicyDatabase#getPolicy(int)
   */
  public Policy getPolicy(int id) throws Exception {
    String cacheKey = "policy-" + id;
    Policy pol = (Policy) policyCache.retrieve(cacheKey);
    if (pol == null) {
      // Get the top level policy
      JDBCPreparedStatement ps = db.getStatement("getPolicy.selectById");
      ps.setInt(1, id);
      try {
View Full Code Here

Examples of com.adito.policyframework.Policy

   * (non-Javadoc)
   *
   * @see com.adito.policyframework.PolicyDatabase#updatePolicy(com.adito.policyframework.Policy)
   */
  public void updatePolicy(Policy policy) throws Exception {
    Policy oldPolicy = getPolicy(policy.getResourceId());
    if (oldPolicy == null) {
      throw new Exception("Cannot update a policy that doesnt exist");
    }
    policyCache.clear();
    JDBCPreparedStatement ps = db.getStatement("updatePolicy.update");
View Full Code Here

Examples of com.adito.policyframework.Policy

      ps.releasePreparedStatement();
    }
  }

  public Policy deletePolicy(int id) throws Exception {
    Policy oldPolicy = getPolicy(id);
    if (oldPolicy == null) {
      throw new Exception("Cannot delete a policy that doesnt exist");
    }
    policyCache.clear();
    // Now delete this policy
View Full Code Here

Examples of com.adito.policyframework.Policy

          storeToCache(cacheKey, val);
          return val.booleanValue();
        }
      }
           
            Policy p = getGrantingPolicy(principal, resource);
            val = p == null ? Boolean.FALSE : Boolean.TRUE;

      storeToCache(cacheKey, val);
    }
    return val.booleanValue();
View Full Code Here

Examples of com.adito.policyframework.Policy

  /* (non-Javadoc)
   * @see com.adito.policyframework.PolicyDatabase#getPolicyByName(java.lang.String, int)
   */
  public Policy getPolicyByName(String name, int realmID) throws Exception {
    String cacheKey = "policyByName-" + name;
    Policy pol = (Policy) policyCache.retrieve(cacheKey);
    if (pol == null) {
      JDBCPreparedStatement ps = db
          .getStatement("getPolicyByName.selectByName");
      ps.setString(1, name);
      ps.setInt(2, realmID);
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.