mirror of
https://github.com/rustfs/rustfs.git
synced 2026-09-01 09:48:20 +00:00
refactor(admin): move accountinfo route registration (#1790)
This commit is contained in:
@@ -12,11 +12,11 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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::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 http::{HeaderMap, HeaderValue};
|
||||||
use hyper::StatusCode;
|
use hyper::{Method, StatusCode};
|
||||||
use matchit::Params;
|
use matchit::Params;
|
||||||
use rustfs_credentials::get_global_action_cred;
|
use rustfs_credentials::get_global_action_cred;
|
||||||
use rustfs_ecstore::bucket::versioning_sys::BucketVersioningSys;
|
use rustfs_ecstore::bucket::versioning_sys::BucketVersioningSys;
|
||||||
@@ -43,6 +43,16 @@ pub struct AccountInfo {
|
|||||||
|
|
||||||
pub struct AccountInfoHandler {}
|
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) {
|
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)
|
(can_list_bucket || can_get_bucket_location, can_put_object)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// 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::{
|
use crate::{
|
||||||
admin::{
|
admin::{
|
||||||
auth::validate_admin_request,
|
auth::validate_admin_request,
|
||||||
@@ -57,6 +57,7 @@ pub struct AddUserQuery {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn register_user_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<()> {
|
pub fn register_user_route(r: &mut S3Router<AdminOperation>) -> std::io::Result<()> {
|
||||||
|
account_info::register_account_info_route(r)?;
|
||||||
register_user_management_route(r)?;
|
register_user_management_route(r)?;
|
||||||
group::register_group_management_route(r)?;
|
group::register_group_management_route(r)?;
|
||||||
service_account::register_service_account_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<()> {
|
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(
|
r.insert(
|
||||||
Method::GET,
|
Method::GET,
|
||||||
format!("{}{}", ADMIN_PREFIX, "/v3/list-users").as_str(),
|
format!("{}{}", ADMIN_PREFIX, "/v3/list-users").as_str(),
|
||||||
|
|||||||
Reference in New Issue
Block a user