@Override public long getEntityOwnerId() { Account activeAccountByName = _accountService.getActiveAccountByName(accountName, domainId); if (activeAccountByName != null) { return activeAccountByName.getAccountId(); } return Account.ACCOUNT_ID_SYSTEM; }
@Override public long getEntityOwnerId() { Account caller = CallContext.current().getCallingAccount(); return caller.getAccountId(); }
public long getAccountIdForAccountUuid(String accountUuid) { Account account = accountDao.findByUuid(accountUuid); if (account == null) { throw new CloudRuntimeException("Unable to find Account for ID: " + accountUuid); } return account.getAccountId(); }
@Override public long getEntityOwnerId() { return CallContext.current().getCallingAccount().getAccountId(); } }
@Override public long getEntityOwnerId() { Account caller = CallContext.current().getCallingAccount(); return caller.getAccountId(); }
@Override public long getEntityOwnerId() { Account caller = CallContext.current().getCallingAccount(); return caller.getAccountId(); }
@Override public long getEntityOwnerId() { return CallContext.current().getCallingAccount().getAccountId(); } }
@Override public long getEntityOwnerId() { Account caller = CallContext.current().getCallingAccount(); return caller.getAccountId(); }
@Override public long getEntityOwnerId() { Account caller = CallContext.current().getCallingAccount(); return caller.getAccountId(); }
@Override public long getEntityOwnerId() { Account caller = CallContext.current().getCallingAccount(); return caller.getAccountId(); }
@Override public long getEntityOwnerId() { Account caller = CallContext.current().getCallingAccount(); return caller.getAccountId(); }
@Override public long getEntityOwnerId() { Account account = CallContext.current().getCallingAccount();// Let's give the caller here for event logging. if (account != null) { return account.getAccountId(); } return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked }
@Override public long getEntityOwnerId() { Account account = _entityMgr.findById(Account.class, getId()); if (account != null) { return account.getAccountId(); } account = _accountService.getActiveAccountByName(getAccountName(), getDomainId()); if (account != null) { return account.getAccountId(); } return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked }
@Override public long getEntityOwnerId() { Account account = _entityMgr.findById(Account.class, getId()); if (account != null) { return account.getAccountId(); } account = _accountService.getActiveAccountByName(getAccountName(), getDomainId()); if (account != null) { return account.getAccountId(); } return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked }
@Override public long getEntityOwnerId() { Account account = _entityMgr.findById(Account.class, getId()); if (account != null) { return account.getAccountId(); } account = _accountService.getActiveAccountByName(getAccountName(), getDomainId()); if (account != null) { return account.getAccountId(); } return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked }
@Override public long getEntityOwnerId() { final Account account = _accountService.getActiveAccountByName(getAccountName(), getDomainId()); if (account != null) { return account.getAccountId(); } return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked }
/** * @param cmd * @param owner * @throws InvalidParameterValueException */ protected void checkForKeyByName(final RegisterSSHKeyPairCmd cmd, final Account owner) throws InvalidParameterValueException { final SSHKeyPairVO existingPair = _sshKeyPairDao.findByName(owner.getAccountId(), owner.getDomainId(), cmd.getName()); if (existingPair != null) { throw new InvalidParameterValueException("A key pair with name '" + cmd.getName() + "' already exists for this account."); } }
/** * @param cmd * @param owner * @throws InvalidParameterValueException */ private void checkForKeyByPublicKey(final RegisterSSHKeyPairCmd cmd, final Account owner) throws InvalidParameterValueException { final SSHKeyPairVO existingPair = _sshKeyPairDao.findByPublicKey(owner.getAccountId(), owner.getDomainId(), getPublicKeyFromKeyKeyMaterial(cmd.getPublicKey())); if (existingPair != null) { throw new InvalidParameterValueException("A key pair with key '" + cmd.getPublicKey() + "' already exists for this account."); } }
private SSHKeyPair createAndSaveSSHKeyPair(final String name, final String fingerprint, final String publicKey, final String privateKey, final Account owner) { final SSHKeyPairVO newPair = new SSHKeyPairVO(); newPair.setAccountId(owner.getAccountId()); newPair.setDomainId(owner.getDomainId()); newPair.setName(name); newPair.setFingerprint(fingerprint); newPair.setPublicKey(publicKey); newPair.setPrivateKey(privateKey); // transient; not saved. _sshKeyPairDao.persist(newPair); return newPair; }
@Override @ActionEvent(eventType = EventTypes.EVENT_SECURITY_GROUP_CREATE, eventDescription = "creating security group") public SecurityGroupVO createSecurityGroup(CreateSecurityGroupCmd cmd) throws PermissionDeniedException, InvalidParameterValueException { String name = cmd.getSecurityGroupName(); Account caller = CallContext.current().getCallingAccount(); Account owner = _accountMgr.finalizeOwner(caller, cmd.getAccountName(), cmd.getDomainId(), cmd.getProjectId()); if (_securityGroupDao.isNameInUse(owner.getId(), owner.getDomainId(), cmd.getSecurityGroupName())) { throw new InvalidParameterValueException("Unable to create security group, a group with name " + name + " already exists."); } return createSecurityGroup(cmd.getSecurityGroupName(), cmd.getDescription(), owner.getDomainId(), owner.getAccountId(), owner.getAccountName()); }