Examples of Policy


Examples of com.adito.policyframework.Policy

                                 && (requiredPermission.getId() == PolicyConstants.PERM_PERSONAL_CREATE_EDIT_AND_DELETE_ID)) {
                                    List policiesResource = getPoliciesAttachedToResource(resource, user.getRealm());
                                    if (policiesResource.size() != 1) {
                                        val = Boolean.FALSE;
                                    } else {
                                        Policy policy = (Policy) policiesResource.get(0);
                                        Policy policyUser = getGrantingPolicyForUser(user, resource);
                                        if (!policy.equals(policyUser)) {
                                            val = Boolean.FALSE;
                                        } else {
                                            if ((policy.getType() != Policy.TYPE_PERSONAL) || (!policy.getResourceName().equals(PolicyUtil.getPersonalPolicyName(user.getPrincipalName())))) {
                                                val = Boolean.FALSE;
View Full Code Here

Examples of com.adito.policyframework.Policy

                // LDP - Add the policies attached to a resource
                // as well
                List del = getPoliciesAttachedToResource(resourcePermission, user.getRealm());

                for (Iterator k = del.iterator(); k.hasNext();) {
                  Policy p = (Policy) k.next();
                  if (!l.contains(p)) {
                    l.add(p);
                  }
                }
                break;
View Full Code Here

Examples of com.adito.policyframework.Policy

   
    /* (non-Javadoc)
     * @see com.adito.policyframework.PolicyDatabase#getGrantingPolicyForUser(com.adito.security.User, com.adito.policyframework.Resource)
     */
    public Policy getGrantingPolicyForUser(User user, Resource resource) throws Exception {
        Policy policy = null;
        if((policy = getGrantingPolicy(user, resource))==null) {
            Role[] roles = user.getRoles();
            for(int i=0;i<roles.length;i++) {
               
                if((policy = getGrantingPolicy(roles[i], resource))!=null) {
View Full Code Here

Examples of com.adito.policyframework.Policy

     */
    private Policy getGrantingPolicy(Principal principal, Resource resource) throws Exception {
        String cacheKey = "grantingPolicy-" + principal.getPrincipalName() + "-realmID-" + principal.getRealm().getResourceId()
                + "-" + resource.getResourceId() + "-"
                + resource.getResourceType().getResourceTypeId();
        Policy val = (Policy) policyCache.retrieve(cacheKey);
        if (val == null) {
            List policies = getPoliciesAttachedToResource(resource, principal.getRealm());
            for (Iterator i = policies.iterator(); val == null && i.hasNext();) {
                Policy p = (Policy) i.next();
                if (isPolicyGrantedToPrincipal(p, principal)) {
                    val = p;
                }
                if (principal instanceof User) {
                    Role[] r = ((User) principal).getRoles();
View Full Code Here

Examples of com.adito.policyframework.Policy

     * @see com.adito.policyframework.PolicyDatabase#detachResourceFromPolicyList(com.adito.policyframework.Resource, com.adito.security.SessionInfo)
     */
    public void detachResourceFromPolicyList(Resource resource, SessionInfo session) throws Exception {
        List policies = getPolicies(session.getUser().getRealm());
        for (Iterator i = policies.iterator(); i.hasNext();) {
            Policy p = (Policy) i.next();
            if(isResourceAttachedToPolicy(resource, p, session.getUser().getRealm())) {
                if (log.isDebugEnabled())
                    log.debug("Detaching policy " + p.getResourceName() + " (" + p.getResourceId() + ") to resource "
                                + resource.getResourceName() + "(id=" + resource.getResourceId() + ", type="
                                + resource.getResourceType() + ")");
                try {
                    detachResourceFromPolicy(resource, p, session.getUser().getRealm());
                    CoreServlet.getServlet().fireCoreEvent(new ResourceDetachedFromPolicyEvent(this, resource, p, session, CoreEvent.STATE_SUCCESSFUL));
View Full Code Here

Examples of com.adito.policyframework.Policy

     * @see com.adito.policyframework.PolicyDatabase#attachResourceToPolicyList(com.adito.policyframework.Resource, com.adito.boot.PropertyList, com.adito.security.SessionInfo)
     */
    public void attachResourceToPolicyList(Resource resource, PropertyList selectedPolicies, SessionInfo session) throws Exception {
        List l = getPoliciesAttachedToResource(resource, session.getUser().getRealm());
        for (Iterator i = l.iterator(); i.hasNext();) {
            Policy p = (Policy) i.next();
            if(!selectedPolicies.contains(String.valueOf(p.getResourceId()))) {
                if (log.isDebugEnabled())
                    log.debug("Detaching policy " + p.getResourceName() + " (" + p.getResourceId() + ") to resource "
                                + resource.getResourceName() + "(id=" + resource.getResourceId() + ", type="
                                + resource.getResourceType() + ")");
                try {
                    detachResourceFromPolicy(resource, p, session.getUser().getRealm());
                    CoreServlet.getServlet().fireCoreEvent(new ResourceDetachedFromPolicyEvent(this, resource, p, session, CoreEvent.STATE_SUCCESSFUL));
                }
                catch(Exception e) {
                    CoreServlet.getServlet().fireCoreEvent(new ResourceDetachedFromPolicyEvent(this, resource, p, session, CoreEvent.STATE_UNSUCCESSFUL));
                    throw e;
                }               
            }
        }
        int idx = 0;
        for (Iterator i = selectedPolicies.iterator(); i.hasNext(); ) {
            String pn = (String)i.next();
            Policy p = getPolicy(Integer.parseInt(pn));
            if (!l.contains(p)) {
                if (log.isDebugEnabled())
                    log.debug("Attaching policy " + p.getResourceName() + " (" + p.getResourceId() + ") to resource "
                                + resource.getResourceName() + "(id=" + resource.getResourceId() + ", type="
                                + resource.getResourceType() + ")");
                try {
                    attachResourceToPolicy(resource, p, idx++, session.getUser().getRealm());
                    CoreServlet.getServlet().fireCoreEvent(new ResourceAttachedToPolicyEvent(this, resource, p, session, CoreEvent.STATE_SUCCESSFUL));
View Full Code Here

Examples of com.aerospike.client.policy.Policy

   */
  public CitrusleafClient() {
    ClLogInit();
    defaultWritePolicy = new WritePolicy();
    defaultWritePolicy.timeout = DEFAULT_TIMEOUT;
    defaultPolicy = new Policy();
    defaultPolicy.timeout = DEFAULT_TIMEOUT;
  }
View Full Code Here

Examples of com.alu.e3.data.model.Policy

    props.putAll(identity.getApi().getProperties());
    Iterator<CallDescriptor> it = identity.getCallDescriptors().iterator();
    while(it.hasNext()){
      CallDescriptor cd = it.next();
      Policy policy = cd.getPolicy();
      if(policy != null){
        props.putAll(policy.getProperties());
      }
    }

    if(identity.getAuth() != null)
      props.putAll(identity.getAuth().getProperties());
View Full Code Here

Examples of com.alu.e3.prov.restapi.model.Policy

  protected final Action newCreateAction() {
    return new Action() {

      @Override
      protected Object doAction(Object... params) {
        Policy policy = (Policy) params[0];

        if ((policy.getId() == null) || (policy.getId().equals("")))
        {
          // create the id
          policy.setId(UUID.randomUUID().toString());
        }

        /**
         * Some validation
         */
        for(Key key : policy.getProperties()){
          if(key.getName() == null || key.getName().isEmpty())
            throw new IllegalArgumentException("All properties must have a name");
        }

        if(LOG.isDebugEnabled()) {
          LOG.debug("Creating Policy:", policy.getId());
        }

        com.alu.e3.data.model.Policy policyDataModel = BeanConverterUtil.toDataModel(policy);
        dataManager.addPolicy(policyDataModel);

        PolicyResponse response = new PolicyResponse(PolicyResponse.SUCCESS);
        response.setId(policy.getId());

        return response;
      }
    };
  }
View Full Code Here

Examples of com.amazonaws.auth.policy.Policy

        }

        JsonNode policyNode;
        JsonNode idNode;
        JsonNode statementNodes;
        Policy policy = new Policy();
        List<Statement> statements = new LinkedList<Statement>();

        try {
            policyNode = Jackson.jsonNodeOf(jsonString);

            idNode = policyNode.get(JsonDocumentFields.POLICY_ID);
            if (isNotNull(idNode)) {
                policy.setId(idNode.asText());
            }

            statementNodes = policyNode.get(JsonDocumentFields.STATEMENT);
            if (isNotNull(statementNodes)) {
                for (JsonNode node : statementNodes) {
                    statements.add(statementOf(node));
                }
            }

        } catch (Exception e) {
            String message = "Unable to generate policy object fron JSON string "
                    + e.getMessage();
            throw new IllegalArgumentException(message, e);
        }
        policy.setStatements(statements);
        return policy;
    }
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.