/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
*
* It is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
*/
package com.cloud.user;
import java.util.Map;
import com.cloud.acl.ControlledEntity;
import com.cloud.acl.SecurityChecker.AccessType;
import com.cloud.domain.Domain;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.utils.Pair;
/**
* AccountManager includes logic that deals with accounts, domains, and users.
*
*/
public interface AccountManager extends AccountService {
/**
* Disables an account by accountId
* @param accountId
* @return true if disable was successful, false otherwise
*/
boolean disableAccount(long accountId) throws ConcurrentOperationException, ResourceUnavailableException;
boolean deleteAccount(AccountVO account, long callerUserId, Account caller);
void checkAccess(Account account, Domain domain) throws PermissionDeniedException;
void checkAccess(Account account, AccessType accessType, ControlledEntity... entities) throws PermissionDeniedException;
boolean cleanupAccount(AccountVO account, long callerUserId, Account caller);
Long checkAccessAndSpecifyAuthority(Account caller, Long zoneId);
Account createAccount(String accountName, short accountType, Long domainId, String networkDomain, Map details);
UserVO createUser(long accountId, String userName, String password, String firstName, String lastName, String email, String timezone);
/**
* Logs out a user
* @param userId
*/
void logoutUser(Long userId);
UserAccount getUserAccount(String username, Long domainId);
/**
* Authenticates a user when s/he logs in.
*
* @param username
* required username for authentication
* @param password
* password to use for authentication, can be null for single sign-on case
* @param domainId
* id of domain where user with username resides
* @param requestParameters
* the request parameters of the login request, which should contain timestamp of when the request signature is
* made, and the signature itself in the single sign-on case
* @return a user object, null if the user failed to authenticate
*/
UserAccount authenticateUser(String username, String password, Long domainId, Map requestParameters);
/**
* Locate a user by their apiKey
*
* @param apiKey
* that was created for a particular user
* @return the user/account pair if one exact match was found, null otherwise
*/
Pair findUserByApiKey(String apiKey);
boolean lockAccount(long accountId);
}