本文整理了Java中org.zstack.header.identity.Quota.getOperator
方法的一些代码示例,展示了Quota.getOperator
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quota.getOperator
方法的具体详情如下:
包路径:org.zstack.header.identity.Quota
类名称:Quota
方法名:getOperator
暂无
代码示例来源:origin: zstackio/zstack
@Override
public void beforeDeliveryMessage(Message msg) {
if (msg instanceof NeedQuotaCheckMessage) {
if (((NeedQuotaCheckMessage) msg).getAccountUuid() == null ||
((NeedQuotaCheckMessage) msg).getAccountUuid().equals("")) {
// skip admin scheduler
return;
}
List<Quota> quotas = acntMgr.getMessageQuotaMap().get(msg.getClass());
if (quotas == null || quotas.size() == 0) {
return;
}
Map<String, Quota.QuotaPair> pairs = new QuotaUtil().
makeQuotaPairs(((NeedQuotaCheckMessage) msg).getAccountUuid());
for (Quota quota : quotas) {
quota.getOperator().checkQuota((NeedQuotaCheckMessage) msg, pairs);
}
}
}
}, VolumeCreateSnapshotMsg.class, CreateVolumeSnapshotMsg.class);
代码示例来源:origin: zstackio/zstack
List<Quota.QuotaUsage> us = q.getOperator().getQuotaUsageByAccount(msg.getAccountUuid());
DebugUtils.Assert(us != null, String.format("%s returns null quotas", q.getOperator().getClass()));
usages.addAll(us);
代码示例来源:origin: zstackio/zstack
@Override
public void check(RBACEntity entity) {
if (acntMgr.isAdmin(entity.getApiMessage().getSession())) {
return;
}
List<Quota> quotas = acntMgr.getMessageQuotaMap().get(entity.getApiMessage().getClass());
if (quotas == null || quotas.isEmpty()) {
return;
}
quotas.forEach(quota -> {
Map<String, Quota.QuotaPair> pairs = new QuotaUtil().makeQuotaPairs(entity.getApiMessage().getSession().getAccountUuid());
quota.getOperator().checkQuota(entity.getApiMessage(), pairs);
if (quota.getQuotaValidators() != null) {
for (Quota.QuotaValidator q : quota.getQuotaValidators()) {
q.checkQuota(entity.getApiMessage(), pairs);
}
}
});
}
}
代码示例来源:origin: zstackio/zstack
private void check(APIMessage msg, Quota quota) {
Map<String, QuotaPair> pairs = new QuotaUtil().makeQuotaPairs(msg.getSession().getAccountUuid());
quota.getOperator().checkQuota(msg, pairs);
if (quota.getQuotaValidators() != null) {
for (Quota.QuotaValidator q : quota.getQuotaValidators()) {
q.checkQuota(msg, pairs);
}
}
}
}
代码示例来源:origin: zstackio/zstack
private void checkQuotaForChangeResourceOwner(APIChangeResourceOwnerMsg msg) {
String currentAccountUuid = msg.getSession().getAccountUuid();
String resourceTargetOwnerAccountUuid = msg.getAccountUuid();
if (new QuotaUtil().isAdminAccount(resourceTargetOwnerAccountUuid)) {
return;
}
// check if change resource owner to self
SimpleQuery<AccountResourceRefVO> queryAccResRefVO = dbf.createQuery(AccountResourceRefVO.class);
queryAccResRefVO.add(AccountResourceRefVO_.resourceUuid, Op.EQ, msg.getResourceUuid());
AccountResourceRefVO accResRefVO = queryAccResRefVO.find();
String resourceOriginalOwnerAccountUuid = accResRefVO.getOwnerAccountUuid();
if (resourceTargetOwnerAccountUuid.equals(resourceOriginalOwnerAccountUuid)) {
throw new ApiMessageInterceptionException(err(IdentityErrors.QUOTA_INVALID_OP,
"Invalid ChangeResourceOwner operation." +
"Original owner is the same as target owner." +
"Current account is [uuid: %s]." +
"The resource target owner account[uuid: %s]." +
"The resource original owner account[uuid:%s].",
currentAccountUuid, resourceTargetOwnerAccountUuid, resourceOriginalOwnerAccountUuid
));
}
// check quota
Map<String, QuotaPair> pairs = new QuotaUtil().makeQuotaPairs(msg.getAccountUuid());
for (Quota quota : messageQuotaMap.get(APIChangeResourceOwnerMsg.class)) {
quota.getOperator().checkQuota(msg, pairs);
}
}
内容来源于网络,如有侵权,请联系作者删除!