permissions: allow user with 'viewer' permissions to access read-only crawlconfig apis (#687)
addresses issue in #653, fixes #685
This commit is contained in:
parent
666c28f420
commit
c2fa78859b
@ -717,10 +717,11 @@ def init_crawl_config_api(
|
|||||||
router = ops.router
|
router = ops.router
|
||||||
|
|
||||||
org_crawl_dep = org_ops.org_crawl_dep
|
org_crawl_dep = org_ops.org_crawl_dep
|
||||||
|
org_viewer_dep = org_ops.org_viewer_dep
|
||||||
|
|
||||||
@router.get("", response_model=Page[CrawlConfigOut])
|
@router.get("", response_model=Page[CrawlConfigOut])
|
||||||
async def get_crawl_configs(
|
async def get_crawl_configs(
|
||||||
org: Organization = Depends(org_crawl_dep),
|
org: Organization = Depends(org_viewer_dep),
|
||||||
userid: Optional[UUID4] = None,
|
userid: Optional[UUID4] = None,
|
||||||
tag: Union[List[str], None] = Query(default=None),
|
tag: Union[List[str], None] = Query(default=None),
|
||||||
):
|
):
|
||||||
@ -728,17 +729,17 @@ def init_crawl_config_api(
|
|||||||
return paginate(crawl_configs)
|
return paginate(crawl_configs)
|
||||||
|
|
||||||
@router.get("/tags")
|
@router.get("/tags")
|
||||||
async def get_crawl_config_tags(org: Organization = Depends(org_crawl_dep)):
|
async def get_crawl_config_tags(org: Organization = Depends(org_viewer_dep)):
|
||||||
return await ops.get_crawl_config_tags(org)
|
return await ops.get_crawl_config_tags(org)
|
||||||
|
|
||||||
@router.get("/{cid}", response_model=CrawlConfigOut)
|
@router.get("/{cid}", response_model=CrawlConfigOut)
|
||||||
async def get_crawl_config(cid: str, org: Organization = Depends(org_crawl_dep)):
|
async def get_crawl_config(cid: str, org: Organization = Depends(org_viewer_dep)):
|
||||||
return await ops.get_crawl_config_out(uuid.UUID(cid), org)
|
return await ops.get_crawl_config_out(uuid.UUID(cid), org)
|
||||||
|
|
||||||
@router.get(
|
@router.get(
|
||||||
"/{cid}/revs",
|
"/{cid}/revs",
|
||||||
response_model=List[ConfigRevision],
|
response_model=List[ConfigRevision],
|
||||||
dependencies=[Depends(org_crawl_dep)],
|
dependencies=[Depends(org_viewer_dep)],
|
||||||
)
|
)
|
||||||
async def get_crawl_config_revisions(cid: str):
|
async def get_crawl_config_revisions(cid: str):
|
||||||
return await ops.get_crawl_config_revs(uuid.UUID(cid))
|
return await ops.get_crawl_config_revs(uuid.UUID(cid))
|
||||||
|
Loading…
Reference in New Issue
Block a user