Hide users tab from bucket view when LDAP is enabled (#719)

This commit is contained in:
Lenin Alevski
2021-05-07 17:48:03 -07:00
committed by GitHub
parent cc02b21632
commit f5beb90608
22 changed files with 53 additions and 317 deletions

View File

@@ -31,7 +31,8 @@ var (
errPolicyNameNotInRequest = errors.New("error policy name not in request")
errPolicyBodyNotInRequest = errors.New("error policy body not in request")
errInvalidEncryptionAlgorithm = errors.New("error invalid encryption algorithm")
errSSENotConfigured = errors.New("error server side encryption configuration was not found")
errSSENotConfigured = errors.New("error server side encryption configuration not found")
errBucketLifeCycleNotConfigured = errors.New("error bucket life cycle configuration not found")
errChangePassword = errors.New("error please check your current password")
errInvalidLicense = errors.New("invalid license key")
errLicenseNotFound = errors.New("license not found")
@@ -99,6 +100,16 @@ func prepareError(err ...error) *models.Error {
errorCode = 401
errorMessage = errorGenericInvalidSession.Error()
}
// Bucket life cycle not configured
if errors.Is(err[0], errBucketLifeCycleNotConfigured) {
errorCode = 404
errorMessage = errBucketLifeCycleNotConfigured.Error()
}
// Encryption not configured
if errors.Is(err[0], errSSENotConfigured) {
errorCode = 404
errorMessage = errSSENotConfigured.Error()
}
// account change password
if madmin.ToErrorResponse(err[0]).Code == "SignatureDoesNotMatch" {
errorCode = 403

View File

@@ -106,7 +106,7 @@ func getBucketLifecycleResponse(session *models.Principal, params user_api.GetBu
bucketEvents, err := getBucketLifecycle(ctx, minioClient, params.BucketName)
if err != nil {
return nil, prepareError(err)
return nil, prepareError(errBucketLifeCycleNotConfigured, err)
}
return bucketEvents, nil
}