// 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 apiNames); AclRole revokeApiPermissionFromAclRole(long aclRoleId, List apiNames); AclGroup addAclRolesToGroup(List roleIds, Long groupId); AclGroup removeAclRolesFromGroup(List roleIds, Long groupId); AclGroup addAccountsToGroup(List acctIds, Long groupId); AclGroup removeAccountsFromGroup(List 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 getAclRoles(long accountId); List getAclGroups(long accountId); AclRolePermission getAclRolePermission(long accountId, String entityType, AccessType accessType); Pair, List> getAclEntityPermission(long accountId, String entityType, AccessType accessType); boolean isAPIAccessibleForRoles(String apiName, List roles); List getEffectiveRoles(Account caller, ControlledEntity entity); List getGrantedDomains(long accountId, AclEntityType entityType, String action); List getGrantedAccounts(long accountId, AclEntityType entityType, String action); List getGrantedResources(long accountId, AclEntityType entityType, String action); }