refactor(admin): move accountinfo route registration (#1790)

This commit is contained in:
安正超
2026-02-13 10:36:54 +08:00
committed by GitHub
parent bfc924a70b
commit 921cfb849c
2 changed files with 15 additions and 10 deletions
+13 -3
View File
@@ -12,11 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use crate::admin::router::Operation;
use crate::admin::router::{AdminOperation, Operation, S3Router};
use crate::auth::{check_key_valid, get_condition_values, get_session_token};
use crate::server::RemoteAddr;
use crate::server::{ADMIN_PREFIX, RemoteAddr};
use http::{HeaderMap, HeaderValue};
use hyper::StatusCode;
use hyper::{Method, StatusCode};
use matchit::Params;
use rustfs_credentials::get_global_action_cred;
use rustfs_ecstore::bucket::versioning_sys::BucketVersioningSys;
@@ -43,6 +43,16 @@ pub struct AccountInfo {
pub struct AccountInfoHandler {}
pub fn register_account_info_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<()> {
r.insert(
Method::GET,
format!("{}{}", ADMIN_PREFIX, "/v3/accountinfo").as_str(),
AdminOperation(&AccountInfoHandler {}),
)?;
Ok(())
}
fn resolve_bucket_access(can_list_bucket: bool, can_get_bucket_location: bool, can_put_object: bool) -> (bool, bool) {
(can_list_bucket || can_get_bucket_location, can_put_object)
}
+2 -7
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use super::{account_info::AccountInfoHandler, event, group, policies, service_account};
use super::{account_info, event, group, policies, service_account};
use crate::{
admin::{
auth::validate_admin_request,
@@ -57,6 +57,7 @@ pub struct AddUserQuery {
}
pub fn register_user_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<()> {
account_info::register_account_info_route(r)?;
register_user_management_route(r)?;
group::register_group_management_route(r)?;
service_account::register_service_account_route(r)?;
@@ -68,12 +69,6 @@ pub fn register_user_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<
}
fn register_user_management_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<()> {
r.insert(
Method::GET,
format!("{}{}", ADMIN_PREFIX, "/v3/accountinfo").as_str(),
AdminOperation(&AccountInfoHandler {}),
)?;
r.insert(
Method::GET,
format!("{}{}", ADMIN_PREFIX, "/v3/list-users").as_str(),