cloudstack-mirror/api/src/org/apache/cloudstack/acl/AclService.java
2013-11-22 16:36:38 -08:00

99 lines
3.2 KiB
Java

// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.acl;
import java.util.List;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
public interface AclService {
/**
* Creates an acl role for the given domain.
*
* @param domainId
* @param name
* @param description
* @return AclRole
*/
AclRole createAclRole(Long domainId, String aclRoleName, String description, Long parentRoleId);
/**
* Delete an acl role.
*
* @param aclRoleId
*/
boolean deleteAclRole(long aclRoleId);
AclRole grantApiPermissionToAclRole(long aclRoleId, List<String> apiNames);
AclRole revokeApiPermissionFromAclRole(long aclRoleId, List<String> apiNames);
AclGroup addAclRolesToGroup(List<Long> roleIds, Long groupId);
AclGroup removeAclRolesFromGroup(List<Long> roleIds, Long groupId);
AclGroup addAccountsToGroup(List<Long> acctIds, Long groupId);
AclGroup removeAccountsFromGroup(List<Long> acctIds, Long groupId);
AclGroup grantEntityPermissionToAclGroup(long aclGroupId, String entityType, long entityId, AccessType accessType);
AclGroup revokeEntityPermissionFromAclGroup(long aclGroupId, String entityType, long entityId, AccessType accessType);
/**
* Creates an acl group for the given domain.
*
* @param domainId
* @param name
* @param description
* @return AclGroup
*/
AclGroup createAclGroup(Long domainId, String aclGroupName, String description);
/**
* Delete an acl group.
*
* @param aclGroupId
*/
boolean deleteAclGroup(Long aclGroupId);
List<AclRole> getAclRoles(long accountId);
List<AclGroup> getAclGroups(long accountId);
AclRolePermission getAclRolePermission(long accountId, String entityType, AccessType accessType);
Pair<List<Long>, List<Long>> getAclEntityPermission(long accountId, String entityType, AccessType accessType);
boolean isAPIAccessibleForRoles(String apiName, List<AclRole> roles);
List<AclRole> getEffectiveRoles(Account caller, ControlledEntity entity);
List<Long> getGrantedDomains(long accountId, AclEntityType entityType, String action);
List<Long> getGrantedAccounts(long accountId, AclEntityType entityType, String action);
List<Long> getGrantedResources(long accountId, AclEntityType entityType, String action);
}