Examples of VpnUser


Examples of com.cloud.network.VpnUser

        addVpnUserCmd._accountService = accountService;

        RemoteAccessVpnService ravService = Mockito.mock(RemoteAccessVpnService.class);

        VpnUser vpnUser = Mockito.mock(VpnUser.class);
        Mockito.when(ravService.addVpnUser(Matchers.anyLong(), Matchers.anyString(), Matchers.anyString())).thenReturn(vpnUser);

        addVpnUserCmd._ravService = ravService;

        addVpnUserCmd.create();
View Full Code Here

Examples of com.cloud.network.VpnUser

        return EventTypes.EVENT_VPN_USER_ADD;
    }

    @Override
    public void execute(){
        VpnUser vpnUser = _entityMgr.findById(VpnUser.class, getEntityId());
        Account account = _entityMgr.findById(Account.class, vpnUser.getAccountId());
        if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user");
        }

        VpnUsersResponse vpnResponse = new VpnUsersResponse();
        vpnResponse.setId(vpnUser.getUuid());
        vpnResponse.setUserName(vpnUser.getUsername());
        vpnResponse.setAccountName(account.getAccountName());

        Domain domain = _entityMgr.findById(Domain.class, account.getDomainId());
        if (domain != null) {
            vpnResponse.setDomainId(domain.getUuid());
View Full Code Here

Examples of com.cloud.network.VpnUser

    @Override
    public void create() {
        Account owner = _accountService.getAccount(getEntityOwnerId());

        VpnUser vpnUser = _ravService.addVpnUser(owner.getId(), userName, password);
        if (vpnUser == null) {
            throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user");
        }
        setEntityId(vpnUser.getId());
        setEntityUuid(vpnUser.getUuid());
    }
View Full Code Here

Examples of com.cloud.network.VpnUser

                long userCount = _vpnUsersDao.getVpnUserCount(owner.getId());
                if (userCount >= _userLimit) {
                    throw new AccountLimitException("Cannot add more than " + _userLimit + " remote access vpn users");
                }
       
                VpnUser user = _vpnUsersDao.persist(new VpnUserVO(vpnOwnerId, owner.getDomainId(), username, password));
                UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VPN_USER_ADD, user.getAccountId(), 0, user.getId(),
                        user.getUsername(), user.getClass().getName(), user.getUuid());
               
                return user;
            }
        });
    }
View Full Code Here

Examples of com.cloud.network.VpnUser

        long userCount = _vpnUsersDao.getVpnUserCount(owner.getId());
        if (userCount >= _userLimit) {
            throw new AccountLimitException("Cannot add more than " + _userLimit + " remote access vpn users");
        }

        VpnUser user = _vpnUsersDao.persist(new VpnUserVO(vpnOwnerId, owner.getDomainId(), username, password));
        UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VPN_USER_ADD, user.getAccountId(), 0, user.getId(),
                user.getUsername(), user.getClass().getName(), user.getUuid());
        txn.commit();
        return user;
    }
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.