Skip to content

Commit a4f136a

Browse files
authored
Merge branch 'dev' into eelco/filter-nodediff
2 parents fafa4b9 + d185823 commit a4f136a

File tree

3 files changed

+26
-6
lines changed

3 files changed

+26
-6
lines changed

packages/syft/src/syft/service/code/user_code.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,13 +353,13 @@ def _coll_repr_(self) -> dict[str, Any]:
353353
def user(self) -> UserView | SyftError:
354354
api = APIRegistry.api_for(
355355
node_uid=self.syft_node_location,
356-
user_verify_key=self.user_verify_key,
356+
user_verify_key=self.syft_client_verify_key,
357357
)
358358
if api is None:
359359
return SyftError(
360360
message=f"Can't access Syft API. You must login to {self.syft_node_location}"
361361
)
362-
return api.services.user.get_current_user()
362+
return api.services.user.get_by_verify_key(self.user_verify_key)
363363

364364
@property
365365
def status(self) -> UserCodeStatusCollection | SyftError:

packages/syft/src/syft/service/request/request.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,11 +570,14 @@ def approve(
570570
)
571571
if message and metadata and metadata.show_warnings and not disable_warnings:
572572
prompt_warning_message(message=message, confirm=True)
573+
msg = (
574+
"Approving request ",
575+
f"on change {self.code.service_func_name} " if is_code_request else "",
576+
f"for domain {api.node_name}",
577+
)
573578

574-
print(f"Approving request for domain {api.node_name}")
579+
print("".join(msg))
575580
res = api.services.request.apply(self.id, **kwargs)
576-
# if isinstance(res, SyftSuccess):
577-
578581
return res
579582

580583
def deny(self, reason: str) -> SyftSuccess | SyftError:

packages/syft/src/syft/service/user/user_service.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from .user import UserViewPage
3838
from .user import check_pwd
3939
from .user import salt_and_hash_password
40+
from .user_roles import ADMIN_ROLE_LEVEL
4041
from .user_roles import DATA_OWNER_ROLE_LEVEL
4142
from .user_roles import DATA_SCIENTIST_ROLE_LEVEL
4243
from .user_roles import GUEST_ROLE_LEVEL
@@ -220,7 +221,23 @@ def get_current_user(self, context: AuthedServiceContext) -> UserView | SyftErro
220221
credentials=context.credentials, verify_key=context.credentials
221222
)
222223
if result.is_ok():
223-
# this seems weird that we get back None as Ok(None)
224+
user = result.ok()
225+
if user:
226+
return user.to(UserView)
227+
else:
228+
SyftError(message="User not found!")
229+
return SyftError(message=str(result.err()))
230+
231+
@service_method(
232+
path="user.get_by_verify_key", name="get_by_verify_key", roles=ADMIN_ROLE_LEVEL
233+
)
234+
def get_by_verify_key_endpoint(
235+
self, context: AuthedServiceContext, verify_key: SyftVerifyKey
236+
) -> UserView | SyftError:
237+
result = self.stash.get_by_verify_key(
238+
credentials=context.credentials, verify_key=verify_key
239+
)
240+
if result.is_ok():
224241
user = result.ok()
225242
if user:
226243
return user.to(UserView)

0 commit comments

Comments
 (0)