Examples of UserContext


Examples of com.cloud.user.UserContext

    public boolean removeFromLoadBalancer(long loadBalancerId, List<Long> instanceIds) {
        return removeFromLoadBalancerInternal(loadBalancerId, instanceIds, true);
    }

    private boolean removeFromLoadBalancerInternal(long loadBalancerId, List<Long> instanceIds, boolean rollBack) {
        UserContext caller = UserContext.current();

        LoadBalancerVO loadBalancer = _lbDao.findById(Long.valueOf(loadBalancerId));
        if (loadBalancer == null) {
            throw new InvalidParameterException("Invalid load balancer value: " + loadBalancerId);
        }

        _accountMgr.checkAccess(caller.getCaller(), null, true, loadBalancer);

        boolean success = false;
        FirewallRule.State backupState = loadBalancer.getState();
        try {
            loadBalancer.setState(FirewallRule.State.Add);
View Full Code Here

Examples of com.cloud.user.UserContext

    }

    @Override
    @ActionEvent(eventType = EventTypes.EVENT_LOAD_BALANCER_DELETE, eventDescription = "deleting load balancer", async = true)
    public boolean deleteLoadBalancerRule(long loadBalancerId, boolean apply) {
        UserContext ctx = UserContext.current();
        Account caller = ctx.getCaller();

        LoadBalancerVO rule = _lbDao.findById(loadBalancerId);

        if (rule == null) {
            throw new InvalidParameterValueException("Unable to find load balancer rule " + loadBalancerId);
        }
        _accountMgr.checkAccess(caller, null, true, rule);

        boolean result = deleteLoadBalancerRule(loadBalancerId, apply, caller, ctx.getCallerUserId(), true);
        if (!result) {
            throw new CloudRuntimeException("Unable to remove load balancer rule " + loadBalancerId);
        }
        return result;
    }
View Full Code Here

Examples of com.cloud.user.UserContext

    protected long saveStartedEvent() {
        return saveStartedEvent(getEventType(), "Executing job for " + getEventDescription(), getStartEventId());
    }

    protected long saveStartedEvent(String eventType, String description, Long startEventId) {
        UserContext ctx = UserContext.current();
        Long userId = ctx.getCallerUserId();
        userId = (userId == null) ? User.UID_SYSTEM : userId;
        Long startEvent = startEventId;
        if (startEvent == null) {
            startEvent = 0L;
        }
View Full Code Here

Examples of com.cloud.user.UserContext

    protected long saveCompletedEvent(String level, String description) {
        return saveCompletedEvent(level, getEventType(), description, getStartEventId());
    }

    protected long saveCompletedEvent(String level, String eventType, String description, Long startEventId) {
        UserContext ctx = UserContext.current();
        Long userId = ctx.getCallerUserId();
        userId = (userId == null) ? User.UID_SYSTEM : userId;
        Long startEvent = startEventId;
        if (startEvent == null) {
            startEvent = 0L;
        }
View Full Code Here

Examples of com.cloud.user.UserContext

        return getId();
    }

    @Override
    public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
        UserContext ctx = UserContext.current();
        ctx.setEventDetails("Router Id: "+getId());

        VirtualRouter result = _routerService.destroyRouter(getId(), ctx.getCaller(), ctx.getCallerUserId());
        if (result != null) {
            DomainRouterResponse response = _responseGenerator.createDomainRouterResponse(result);
            response.setResponseName(getCommandName());
            this.setResponseObject(response);
        } else {
View Full Code Here

Examples of com.cloud.user.UserContext

    }


    @Override
    public void execute() throws ResourceUnavailableException {
        UserContext callerContext = UserContext.current();
        boolean success = true;
        PortForwardingRule rule = null;
        try {
            UserContext.current().setEventDetails("Rule Id: " + getEntityId());

            if (getOpenFirewall()) {
                success = success && _firewallService.applyIngressFirewallRules(ipAddressId, callerContext.getCaller());
            }

            success = success && _rulesService.applyPortForwardingRules(ipAddressId, callerContext.getCaller());

            // State is different after the rule is applied, so get new object here
            rule = _entityMgr.findById(PortForwardingRule.class, getEntityId());
            FirewallRuleResponse fwResponse = new FirewallRuleResponse();
            if (rule != null) {
View Full Code Here

Examples of com.cloud.user.UserContext

        cidrlist = cidrs;
    }

    @Override
    public void execute() throws ResourceUnavailableException {
        UserContext callerContext = UserContext.current();
        boolean success = false;
        FirewallRule rule = _entityMgr.findById(FirewallRule.class, getEntityId());
        try {
            UserContext.current().setEventDetails("Rule Id: " + getEntityId());
             success = _firewallService.applyEgressFirewallRules (rule, callerContext.getCaller());
            // State is different after the rule is applied, so get new object here
            rule = _entityMgr.findById(FirewallRule.class, getEntityId());
            FirewallResponse fwResponse = new FirewallResponse();
            if (rule != null) {
                fwResponse = _responseGenerator.createFirewallResponse(rule);
View Full Code Here

Examples of com.filenet.api.util.UserContext

    if (password == null) {
      logger.log(Level.WARNING, "Password is NULL");
      throw new RepositoryLoginException();
    }

    UserContext uc = UserContext.get();
    try {
      Subject s = UserContext.createSubject(
          ((FnConnection) conn).getConnection(), username, password,
          "FileNetP8");
      uc.pushSubject(s);
      User u = Factory.User.fetchCurrent(((FnConnection) conn).getConnection(),
          null);
      logger.info("User: " + u.get_Name() + " is authenticated");

      FnCredentialMap.putUserCred(username, password);
View Full Code Here

Examples of no.kommune.bergen.soa.svarut.dto.UserContext

  }

  @Test
  public void createJuridiskEnhetFrombehalfOfIdOk() {
    String onBehalfOfId = "12345678902";
    UserContext userContext = newUserContext( "12345678901", onBehalfOfId );
    JuridiskEnhet juridiskEnhet = JuridiskEnhetFactory.create( userContext );
    Assert.assertTrue( juridiskEnhet instanceof Fodselsnr );
    Assert.assertEquals( onBehalfOfId, juridiskEnhet.getValue() );
  }
View Full Code Here

Examples of no.kommune.bergen.svarut.v1.UserContext

  private UserContext createUserContext() {
    return createUserContext( fnr );
  }

  public static UserContext createUserContext( String fnr ) {
    UserContext uc = new UserContext();
    uc.setUserid( fnr );
    return uc;
  }
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.