Skip to content

Commit

Permalink
Changed local facts config name
Browse files Browse the repository at this point in the history
  • Loading branch information
danyi1212 committed Jun 17, 2024
1 parent 088aa79 commit f3bb41c
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 11 deletions.
4 changes: 3 additions & 1 deletion permit/api/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ def __init__(self, config: PermitConfig):
self.config = config
self.__api_keys = self._build_http_client("/v2/api-key")

def _build_http_client(self, endpoint_url: str = "", *, use_pdp: bool = False, **kwargs):
def _build_http_client(
self, endpoint_url: str = "", *, use_pdp: bool = False, **kwargs
):
client_config = ClientConfig(
base_url=self.config.pdp if use_pdp else self.config.api_url,
headers={
Expand Down
2 changes: 1 addition & 1 deletion permit/api/condition_set_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
class ConditionSetRulesApi(BasePermitApi):
@property
def __condition_set_rules(self) -> SimpleHttpClient:
if self.config.local_facts:
if self.config.proxy_facts_via_pdp:
return self._build_http_client("/facts/set_rules", use_pdp=True)
else:
return self._build_http_client(
Expand Down
2 changes: 1 addition & 1 deletion permit/api/relationship_tuples.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
class RelationshipTuplesApi(BasePermitApi):
@property
def __relationship_tuples(self) -> SimpleHttpClient:
if self.config.local_facts:
if self.config.proxy_facts_via_pdp:
return self._build_http_client("/facts/relationship_tuples", use_pdp=True)
else:
return self._build_http_client(
Expand Down
2 changes: 1 addition & 1 deletion permit/api/role_assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
class RoleAssignmentsApi(BasePermitApi):
@property
def __role_assignments(self) -> SimpleHttpClient:
if self.config.local_facts:
if self.config.proxy_facts_via_pdp:
return self._build_http_client("/facts/role_assignments", use_pdp=True)
else:
return self._build_http_client(
Expand Down
4 changes: 2 additions & 2 deletions permit/api/tenants.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
class TenantsApi(BasePermitApi):
@property
def __tenants(self) -> SimpleHttpClient:
if self.config.local_facts:
if self.config.proxy_facts_via_pdp:
return self._build_http_client("/facts/tenants", use_pdp=True)
else:
return self._build_http_client(
Expand All @@ -42,7 +42,7 @@ def __tenants(self) -> SimpleHttpClient:

@property
def __bulk_operations(self) -> SimpleHttpClient:
if self.config.local_facts:
if self.config.proxy_facts_via_pdp:
return self._build_http_client("/facts/users", use_pdp=True)
else:
return self._build_http_client(
Expand Down
6 changes: 3 additions & 3 deletions permit/api/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
class UsersApi(BasePermitApi):
@property
def __users(self) -> SimpleHttpClient:
if self.config.local_facts:
if self.config.proxy_facts_via_pdp:
return self._build_http_client("/facts/users", use_pdp=True)
else:
return self._build_http_client(
Expand All @@ -47,7 +47,7 @@ def __users(self) -> SimpleHttpClient:

@property
def __role_assignments(self) -> SimpleHttpClient:
if self.config.local_facts:
if self.config.proxy_facts_via_pdp:
return self._build_http_client("/facts/role_assignments", use_pdp=True)
else:
return self._build_http_client(
Expand All @@ -59,7 +59,7 @@ def __role_assignments(self) -> SimpleHttpClient:

@property
def __bulk_operations(self) -> SimpleHttpClient:
if self.config.local_facts:
if self.config.proxy_facts_via_pdp:
return self._build_http_client("/bulk/users", use_pdp=True)
else:
return self._build_http_client(
Expand Down
4 changes: 2 additions & 2 deletions permit/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ class PermitConfig(BaseModel):
None,
description="The timeout in seconds for requests to the PDP.",
)
local_facts: bool = Field(
proxy_facts_via_pdp: bool = Field(
False,
description="Whether to create facts locally in the PDP or use the Permit REST API.",
description="Create facts via the PDP or use the Permit REST API.",
)

class Config:
Expand Down

0 comments on commit f3bb41c

Please sign in to comment.