(ctx context.Context, req *adminv1.RemoveProjectMemberServiceRequest)
| 365 | } |
| 366 | |
| 367 | func (s *Server) RemoveProjectMemberService(ctx context.Context, req *adminv1.RemoveProjectMemberServiceRequest) (*adminv1.RemoveProjectMemberServiceResponse, error) { |
| 368 | observability.AddRequestAttributes(ctx, |
| 369 | attribute.String("args.name", req.Name), |
| 370 | attribute.String("args.organization", req.Org), |
| 371 | attribute.String("args.project", req.Project), |
| 372 | ) |
| 373 | |
| 374 | org, err := s.admin.DB.FindOrganizationByName(ctx, req.Org) |
| 375 | if err != nil { |
| 376 | return nil, err |
| 377 | } |
| 378 | claims := auth.GetClaims(ctx) |
| 379 | if !claims.OrganizationPermissions(ctx, org.ID).ManageOrg { |
| 380 | return nil, status.Error(codes.PermissionDenied, "not allowed to remove service from project") |
| 381 | } |
| 382 | |
| 383 | project, err := s.admin.DB.FindProjectByName(ctx, req.Org, req.Project) |
| 384 | if err != nil { |
| 385 | return nil, err |
| 386 | } |
| 387 | |
| 388 | service, err := s.admin.DB.FindServiceByName(ctx, org.ID, req.Name) |
| 389 | if err != nil { |
| 390 | return nil, err |
| 391 | } |
| 392 | |
| 393 | err = s.admin.DB.DeleteProjectMemberService(ctx, service.ID, project.ID) |
| 394 | if err != nil { |
| 395 | return nil, err |
| 396 | } |
| 397 | |
| 398 | return &adminv1.RemoveProjectMemberServiceResponse{}, nil |
| 399 | } |
| 400 | |
| 401 | // DeleteService deletes a service account. |
| 402 | func (s *Server) DeleteService(ctx context.Context, req *adminv1.DeleteServiceRequest) (*adminv1.DeleteServiceResponse, error) { |
nothing calls this directly
no test coverage detected