Skip to content

Commit

Permalink
chore: update interceptors and path params for list org by domain api
Browse files Browse the repository at this point in the history
  • Loading branch information
Chief-Rishab committed Aug 10, 2023
1 parent 8da92d6 commit cf35161
Show file tree
Hide file tree
Showing 9 changed files with 2,903 additions and 2,893 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TAG := $(shell git rev-list --tags --max-count=1)
VERSION := $(shell git describe --tags ${TAG})
.PHONY: build check fmt lint test test-race vet test-cover-html help install proto ui
.DEFAULT_GOAL := build
PROTON_COMMIT := "5b724a8b1ddb92e1b3b2ddcbee14e215da8b7be6"
PROTON_COMMIT := "9ee14815507860c48d6cfcc140778f0f528eeb69"

ui:
@echo " > generating ui build"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
id: frontier-service-list-organization-domains
title: "List org domains"
description: "Returns all trusted domains for an organization, which are used to allow users to sign up with a specific email domain without invitation. The domain ownership must be verified before it can be used as a trusted domain. Use the verified filter to get only the verified domains."
description: "Returns all domains whitelisted for an organization (both pending and verified if no filters are provided for the state). The verified domains allow users email with the org's whitelisted domain to join the organization without invitation."
sidebar_label: "List org domains"
hide_title: true
hide_table_of_contents: true
api:
{
"description": "Returns all trusted domains for an organization, which are used to allow users to sign up with a specific email domain without invitation. The domain ownership must be verified before it can be used as a trusted domain. Use the verified filter to get only the verified domains.",
"description": "Returns all domains whitelisted for an organization (both pending and verified if no filters are provided for the state). The verified domains allow users email with the org's whitelisted domain to join the organization without invitation.",
"operationId": "FrontierService_ListOrganizationDomains",
"responses":
{
Expand Down Expand Up @@ -326,7 +326,7 @@ api:
"name": "List org domains",
"description":
{
"content": "Returns all trusted domains for an organization, which are used to allow users to sign up with a specific email domain without invitation. The domain ownership must be verified before it can be used as a trusted domain. Use the verified filter to get only the verified domains.",
"content": "Returns all domains whitelisted for an organization (both pending and verified if no filters are provided for the state). The verified domains allow users email with the org's whitelisted domain to join the organization without invitation.",
"type": "text/plain",
},
"url":
Expand Down Expand Up @@ -381,7 +381,7 @@ import TabItem from "@theme/TabItem";

## List org domains

Returns all trusted domains for an organization, which are used to allow users to sign up with a specific email domain without invitation. The domain ownership must be verified before it can be used as a trusted domain. Use the verified filter to get only the verified domains.
Returns all domains whitelisted for an organization (both pending and verified if no filters are provided for the state). The verified domains allow users email with the org's whitelisted domain to join the organization without invitation.

<details style={{"marginBottom":"1rem"}} data-collapsed={false} open={true}><summary style={{}}><strong>Path Parameters</strong></summary><div><ul><ParamsItem className={"paramsItem"} param={{"name":"orgId","description":"unique id of the organization for which whitelisted domains are to be listed","in":"path","required":true,"schema":{"type":"string"}}}></ParamsItem></ul></div></details><details style={{"marginBottom":"1rem"}} data-collapsed={false} open={true}><summary style={{}}><strong>Query Parameters</strong></summary><div><ul><ParamsItem className={"paramsItem"} param={{"name":"state","description":"filter to list domains by their state (pending/verified). If not provided, all domains for an org will be listed","in":"query","required":false,"schema":{"type":"string"}}}></ParamsItem></ul></div></details><div><ApiTabs><TabItem label={"200"} value={"200"}><div>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
id: frontier-service-list-organizations-by-domain
title: "List orgs by domain"
description: "Returns all organizations that have a specific domain whitelisted. This API will return only those organizations in which the domain ownership have been verified."
description: "Returns all organizations that have a specific domain whitelisted. This API will return only those organizations in which the domain ownership have been verified. Useful when you want to show a list of organizations that users can join based on their email domain (by default will also show the orgs of which user is already a part of)."
sidebar_label: "List orgs by domain"
hide_title: true
hide_table_of_contents: true
api:
{
"description": "Returns all organizations that have a specific domain whitelisted. This API will return only those organizations in which the domain ownership have been verified.",
"description": "Returns all organizations that have a specific domain whitelisted. This API will return only those organizations in which the domain ownership have been verified. Useful when you want to show a list of organizations that users can join based on their email domain (by default will also show the orgs of which user is already a part of).",
"operationId": "FrontierService_ListOrganizationsByDomain",
"responses":
{
Expand Down Expand Up @@ -241,16 +241,16 @@ api:
"parameters":
[
{
"name": "domainId",
"description": "domain id or domain name to be used to list all the organizations that have this domain whitelisted",
"name": "name",
"description": "domain name to be used to list all the organizations that have this domain whitelisted",
"in": "path",
"required": true,
"schema": { "type": "string" },
},
],
"tags": ["Organization"],
"method": "get",
"path": "/v1beta1/organizations/domains/{domainId}",
"path": "/v1beta1/organizations/domains/{name}",
"servers": [{ "url": "http://127.0.0.1:7400" }],
"security": [{ "Basic": [] }, { "Bearer": [] }],
"securitySchemes":
Expand Down Expand Up @@ -293,12 +293,12 @@ api:
"name": "List orgs by domain",
"description":
{
"content": "Returns all organizations that have a specific domain whitelisted. This API will return only those organizations in which the domain ownership have been verified.",
"content": "Returns all organizations that have a specific domain whitelisted. This API will return only those organizations in which the domain ownership have been verified. Useful when you want to show a list of organizations that users can join based on their email domain (by default will also show the orgs of which user is already a part of).",
"type": "text/plain",
},
"url":
{
"path": ["v1beta1", "organizations", "domains", ":domainId"],
"path": ["v1beta1", "organizations", "domains", ":name"],
"host": ["{{baseUrl}}"],
"query": [],
"variable":
Expand All @@ -307,12 +307,12 @@ api:
"disabled": false,
"description":
{
"content": "(Required) domain id or domain name to be used to list all the organizations that have this domain whitelisted",
"content": "(Required) domain name to be used to list all the organizations that have this domain whitelisted",
"type": "text/plain",
},
"type": "any",
"value": "",
"key": "domainId",
"key": "name",
},
],
},
Expand All @@ -336,9 +336,9 @@ import TabItem from "@theme/TabItem";

## List orgs by domain

Returns all organizations that have a specific domain whitelisted. This API will return only those organizations in which the domain ownership have been verified.
Returns all organizations that have a specific domain whitelisted. This API will return only those organizations in which the domain ownership have been verified. Useful when you want to show a list of organizations that users can join based on their email domain (by default will also show the orgs of which user is already a part of).

<details style={{"marginBottom":"1rem"}} data-collapsed={false} open={true}><summary style={{}}><strong>Path Parameters</strong></summary><div><ul><ParamsItem className={"paramsItem"} param={{"name":"domainId","description":"domain id or domain name to be used to list all the organizations that have this domain whitelisted","in":"path","required":true,"schema":{"type":"string"}}}></ParamsItem></ul></div></details><div><ApiTabs><TabItem label={"200"} value={"200"}><div>
<details style={{"marginBottom":"1rem"}} data-collapsed={false} open={true}><summary style={{}}><strong>Path Parameters</strong></summary><div><ul><ParamsItem className={"paramsItem"} param={{"name":"name","description":"domain name to be used to list all the organizations that have this domain whitelisted","in":"path","required":true,"schema":{"type":"string"}}}></ParamsItem></ul></div></details><div><ApiTabs><TabItem label={"200"} value={"200"}><div>

A successful response.

Expand Down
4 changes: 2 additions & 2 deletions internal/api/v1beta1/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,10 @@ func transformDomainToPB(from domain.Domain) frontierv1beta1.Domain {
func (h Handler) ListOrganizationsByDomain(ctx context.Context, request *frontierv1beta1.ListOrganizationsByDomainRequest) (*frontierv1beta1.ListOrganizationsByDomainResponse, error) {
logger := grpczap.Extract(ctx)

if request.GetDomainId() == "" {
if request.GetName() == "" {
return nil, grpcBadBodyError
}
orgIDs, err := h.domainService.ListOrgByDomain(ctx, request.GetDomainId())
orgIDs, err := h.domainService.ListOrgByDomain(ctx, request.GetName())
if err != nil {
logger.Error(err.Error())
return nil, grpcInternalServerError
Expand Down
3 changes: 3 additions & 0 deletions pkg/server/interceptors/authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ var authorizationValidationMap = map[string]func(ctx context.Context, handler *v
pbreq := req.(*frontierv1beta1.ListOrganizationDomainsRequest)
return handler.IsAuthorized(ctx, schema.OrganizationNamespace, pbreq.GetOrgId(), schema.GetPermission)
},
"/raystack.frontier.v1beta1.FrontierService/ListOrganizationsByDomain": func(ctx context.Context, handler *v1beta1.Handler, req any) error {
return nil
},
"/raystack.frontier.v1beta1.FrontierService/GetOrganizationDomain": func(ctx context.Context, handler *v1beta1.Handler, req any) error {
pbreq := req.(*frontierv1beta1.GetOrganizationDomainRequest)
return handler.IsAuthorized(ctx, schema.OrganizationNamespace, pbreq.GetId(), schema.GetPermission)
Expand Down
10 changes: 5 additions & 5 deletions proto/apidocs.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1827,7 +1827,7 @@ paths:
/v1beta1/organizations/{orgId}/domains:
get:
summary: List org domains
description: Returns all trusted domains for an organization, which are used to allow users to sign up with a specific email domain without invitation. The domain ownership must be verified before it can be used as a trusted domain. Use the verified filter to get only the verified domains.
description: Returns all domains whitelisted for an organization (both pending and verified if no filters are provided for the state). The verified domains allow users email with the org's whitelisted domain to join the organization without invitation.
operationId: FrontierService_ListOrganizationDomains
responses:
"200":
Expand Down Expand Up @@ -3054,10 +3054,10 @@ paths:
$ref: '#/definitions/v1beta1RoleRequestBody'
tags:
- Role
/v1beta1/organizations/domains/{domainId}:
/v1beta1/organizations/domains/{name}:
get:
summary: List orgs by domain
description: Returns all organizations that have a specific domain whitelisted. This API will return only those organizations in which the domain ownership have been verified.
description: Returns all organizations that have a specific domain whitelisted. This API will return only those organizations in which the domain ownership have been verified. Useful when you want to show a list of organizations that users can join based on their email domain (by default will also show the orgs of which user is already a part of).
operationId: FrontierService_ListOrganizationsByDomain
responses:
"200":
Expand Down Expand Up @@ -3089,8 +3089,8 @@ paths:
schema:
$ref: '#/definitions/rpcStatus'
parameters:
- name: domainId
description: domain id or domain name to be used to list all the organizations that have this domain whitelisted
- name: name
description: domain name to be used to list all the organizations that have this domain whitelisted
in: path
required: true
type: string
Expand Down
Loading

0 comments on commit cf35161

Please sign in to comment.