|
@ -78,7 +78,7 @@ func (iama *IamApiServer) registerRouter(router *mux.Router) { |
|
|
func (iam IamS3ApiConfigure) GetS3ApiConfiguration(s3cfg *iam_pb.S3ApiConfiguration) (err error) { |
|
|
func (iam IamS3ApiConfigure) GetS3ApiConfiguration(s3cfg *iam_pb.S3ApiConfiguration) (err error) { |
|
|
var buf bytes.Buffer |
|
|
var buf bytes.Buffer |
|
|
err = pb.WithGrpcFilerClient(false, iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
err = pb.WithGrpcFilerClient(false, iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
if err = filer.ReadEntry(iam.masterClient, client, filer.IamConfigDirecotry, filer.IamIdentityFile, &buf); err != nil { |
|
|
|
|
|
|
|
|
if err = filer.ReadEntry(iam.masterClient, client, filer.IamConfigDirectory, filer.IamIdentityFile, &buf); err != nil { |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
return nil |
|
|
return nil |
|
@ -101,7 +101,7 @@ func (iam IamS3ApiConfigure) PutS3ApiConfiguration(s3cfg *iam_pb.S3ApiConfigurat |
|
|
} |
|
|
} |
|
|
return pb.WithGrpcFilerClient(false, iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
return pb.WithGrpcFilerClient(false, iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
err = util.Retry("saveIamIdentity", func() error { |
|
|
err = util.Retry("saveIamIdentity", func() error { |
|
|
return filer.SaveInsideFiler(client, filer.IamConfigDirecotry, filer.IamIdentityFile, buf.Bytes()) |
|
|
|
|
|
|
|
|
return filer.SaveInsideFiler(client, filer.IamConfigDirectory, filer.IamIdentityFile, buf.Bytes()) |
|
|
}) |
|
|
}) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return err |
|
|
return err |
|
@ -113,7 +113,7 @@ func (iam IamS3ApiConfigure) PutS3ApiConfiguration(s3cfg *iam_pb.S3ApiConfigurat |
|
|
func (iam IamS3ApiConfigure) GetPolicies(policies *Policies) (err error) { |
|
|
func (iam IamS3ApiConfigure) GetPolicies(policies *Policies) (err error) { |
|
|
var buf bytes.Buffer |
|
|
var buf bytes.Buffer |
|
|
err = pb.WithGrpcFilerClient(false, iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
err = pb.WithGrpcFilerClient(false, iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
if err = filer.ReadEntry(iam.masterClient, client, filer.IamConfigDirecotry, filer.IamPoliciesFile, &buf); err != nil { |
|
|
|
|
|
|
|
|
if err = filer.ReadEntry(iam.masterClient, client, filer.IamConfigDirectory, filer.IamPoliciesFile, &buf); err != nil { |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
return nil |
|
|
return nil |
|
@ -137,7 +137,7 @@ func (iam IamS3ApiConfigure) PutPolicies(policies *Policies) (err error) { |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
return pb.WithGrpcFilerClient(false, iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
return pb.WithGrpcFilerClient(false, iam.option.Filer, iam.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
if err := filer.SaveInsideFiler(client, filer.IamConfigDirecotry, filer.IamPoliciesFile, b); err != nil { |
|
|
|
|
|
|
|
|
if err := filer.SaveInsideFiler(client, filer.IamConfigDirectory, filer.IamPoliciesFile, b); err != nil { |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
return nil |
|
|
return nil |
|
|