@@ -608,33 +608,35 @@ crane::grpc::ModifyCranedStateReply CranedMetaContainer::ChangeNodeState(
608
608
609
609
if (is_modify_allowed) {
610
610
allowed_accounts = accounts;
611
- denied_accounts.clear ();
612
- } else if (allowed_accounts.empty ()) {
613
- // When allowed_accounts is in use, denied_accounts cannot be modified.
611
+ } else {
614
612
denied_accounts = accounts;
615
613
}
616
614
617
615
return result;
618
616
}
619
617
620
- bool CranedMetaContainer::CheckIfAccountIsAllowedInPartition (
618
+ std::expected< void , std::string> CranedMetaContainer::CheckIfAccountIsAllowedInPartition (
621
619
const std::string& partition_name, const std::string& account_name) {
622
620
auto part_metas_map = partition_metas_map_.GetMapSharedPtr ();
623
621
624
- if (!part_metas_map->contains (partition_name)) return false ;
622
+ if (!part_metas_map->contains (partition_name)) return std::unexpected ( " Partition does not exist. " ) ;
625
623
626
624
auto part_meta = part_metas_map->at (partition_name).GetExclusivePtr ();
627
625
const auto & allowed_accounts = part_meta->partition_global_meta .allowed_accounts ;
628
626
if (!allowed_accounts.empty ()) {
629
627
if (!allowed_accounts.contains (account_name))
630
- return false ;
628
+ return std::unexpected (
629
+ " The account is not in the AllowedAccounts of the partition "
630
+ " specified for the task, submission of the task is prohibited." );
631
631
} else {
632
632
const auto & denied_accounts = part_meta->partition_global_meta .denied_accounts ;
633
633
if (denied_accounts.contains (account_name))
634
- return false ;
634
+ return std::unexpected (
635
+ " The account is in the DeniedAccounts of the partition "
636
+ " specified for the task, submission of the task is prohibited." );
635
637
}
636
638
637
- return true ;
639
+ return {} ;
638
640
}
639
641
640
642
void CranedMetaContainer::AddDedicatedResource (
0 commit comments