优化接口权限

This commit is contained in:
刘祥超
2022-09-17 16:07:37 +08:00
parent 55eecce416
commit 1d1ff11eb7
54 changed files with 275 additions and 246 deletions

View File

@@ -15,7 +15,7 @@ type ACMEUserService struct {
// CreateACMEUser 创建用户
func (this *ACMEUserService) CreateACMEUser(ctx context.Context, req *pb.CreateACMEUserRequest) (*pb.CreateACMEUserResponse, error) {
// 校验请求
adminId, userId, err := this.ValidateAdminAndUser(ctx)
adminId, userId, err := this.ValidateAdminAndUser(ctx, false)
if err != nil {
return nil, err
}
@@ -32,7 +32,7 @@ func (this *ACMEUserService) CreateACMEUser(ctx context.Context, req *pb.CreateA
// UpdateACMEUser 修改用户
func (this *ACMEUserService) UpdateACMEUser(ctx context.Context, req *pb.UpdateACMEUserRequest) (*pb.RPCSuccess, error) {
// 校验请求
adminId, userId, err := this.ValidateAdminAndUser(ctx)
adminId, userId, err := this.ValidateAdminAndUser(ctx, false)
if err != nil {
return nil, err
}
@@ -58,7 +58,7 @@ func (this *ACMEUserService) UpdateACMEUser(ctx context.Context, req *pb.UpdateA
// DeleteACMEUser 删除用户
func (this *ACMEUserService) DeleteACMEUser(ctx context.Context, req *pb.DeleteACMEUserRequest) (*pb.RPCSuccess, error) {
// 校验请求
adminId, userId, err := this.ValidateAdminAndUser(ctx)
adminId, userId, err := this.ValidateAdminAndUser(ctx, false)
if err != nil {
return nil, err
}
@@ -84,7 +84,7 @@ func (this *ACMEUserService) DeleteACMEUser(ctx context.Context, req *pb.DeleteA
// CountACMEUsers 计算用户数量
func (this *ACMEUserService) CountACMEUsers(ctx context.Context, req *pb.CountAcmeUsersRequest) (*pb.RPCCountResponse, error) {
// 校验请求
adminId, userId, err := this.ValidateAdminAndUser(ctx)
adminId, userId, err := this.ValidateAdminAndUser(ctx, false)
if err != nil {
return nil, err
}
@@ -104,7 +104,7 @@ func (this *ACMEUserService) CountACMEUsers(ctx context.Context, req *pb.CountAc
// ListACMEUsers 列出单页用户
func (this *ACMEUserService) ListACMEUsers(ctx context.Context, req *pb.ListACMEUsersRequest) (*pb.ListACMEUsersResponse, error) {
// 校验请求
adminId, userId, err := this.ValidateAdminAndUser(ctx)
adminId, userId, err := this.ValidateAdminAndUser(ctx, false)
if err != nil {
return nil, err
}
@@ -180,7 +180,7 @@ func (this *ACMEUserService) ListACMEUsers(ctx context.Context, req *pb.ListACME
// FindEnabledACMEUser 查找单个用户
func (this *ACMEUserService) FindEnabledACMEUser(ctx context.Context, req *pb.FindEnabledACMEUserRequest) (*pb.FindEnabledACMEUserResponse, error) {
// 校验请求
adminId, userId, err := this.ValidateAdminAndUser(ctx)
adminId, userId, err := this.ValidateAdminAndUser(ctx, false)
if err != nil {
return nil, err
}
@@ -260,7 +260,7 @@ func (this *ACMEUserService) FindEnabledACMEUser(ctx context.Context, req *pb.Fi
// FindAllACMEUsers 查找所有用户
func (this *ACMEUserService) FindAllACMEUsers(ctx context.Context, req *pb.FindAllACMEUsersRequest) (*pb.FindAllACMEUsersResponse, error) {
// 校验请求
adminId, userId, err := this.ValidateAdminAndUser(ctx)
adminId, userId, err := this.ValidateAdminAndUser(ctx, false)
if err != nil {
return nil, err
}