mirror of https://github.com/apache/cloudstack.git
Add interface method to remove account group association from
acl_group_account_map.
This commit is contained in:
parent
b633950a68
commit
ded2785bb1
|
|
@ -31,4 +31,6 @@ public interface AclGroupAccountMapDao extends GenericDao<AclGroupAccountMapVO,
|
|||
AclGroupAccountMapVO findAccountInAdminGroup(long accountId);
|
||||
|
||||
AclGroupAccountMapVO findByGroupAndAccount(long groupId, long acctId);
|
||||
|
||||
void removeAccountFromGroups(long accountId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.util.Map;
|
|||
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.acl.AclGroupAccountMapVO;
|
||||
|
|
@ -35,6 +36,8 @@ public class AclGroupAccountMapDaoImpl extends GenericDaoBase<AclGroupAccountMap
|
|||
private SearchBuilder<AclGroupAccountMapVO> ListByAccountId;
|
||||
private SearchBuilder<AclGroupAccountMapVO> _findByAccountAndGroupId;
|
||||
|
||||
public static final Logger s_logger = Logger.getLogger(AclGroupAccountMapDaoImpl.class.getName());
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
super.configure(name, params);
|
||||
|
|
@ -87,4 +90,15 @@ public class AclGroupAccountMapDaoImpl extends GenericDaoBase<AclGroupAccountMap
|
|||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAccountFromGroups(long accountId) {
|
||||
SearchCriteria<AclGroupAccountMapVO> sc = ListByAccountId.create();
|
||||
sc.setParameters("accountId", accountId);
|
||||
|
||||
int rowsRemoved = remove(sc);
|
||||
if (rowsRemoved > 0) {
|
||||
s_logger.debug("Removed account id=" + accountId + " from " + rowsRemoved + " groups");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue