-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure Connect shows Connect My Computer only to local users #29804
Conversation
@@ -333,5 +333,7 @@ export type CreateConnectMyComputerRoleResponse = | |||
export type CreateConnectMyComputerNodeTokenResponse = | |||
apiService.CreateConnectMyComputerNodeTokenResponse.AsObject; | |||
|
|||
export const UserType = apiCluster.LoggedInUser.UserType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can export value and type at the same time (we may need the type in the future).
export const UserType = apiCluster.LoggedInUser.UserType; | |
export { UserType } |
I did it for export { FileTransferDirection }
above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to do this but I didn't know how to reexport something that's defined in a namespace. I think I found a solution, let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I didn't notice that it is defined in a namespace. Your solution is fine, I was afraid that clicking on UserType
somewhere in the code will open the types.ts
file, not the actual definition. But it work as it should!
@@ -333,5 +333,7 @@ export type CreateConnectMyComputerRoleResponse = | |||
export type CreateConnectMyComputerNodeTokenResponse = | |||
apiService.CreateConnectMyComputerNodeTokenResponse.AsObject; | |||
|
|||
export const UserType = apiCluster.LoggedInUser.UserType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to do this but I didn't know how to reexport something that's defined in a namespace. I think I found a solution, let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if those tests add enough value to warrant having them. It'd probably be better to test it indirectly through some more integrated tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably they don't, but I would keep them for now, until we do something better.
Connect My Computer won't work in its current form for SSO users. That's because the implementation depends on updating the role list of a user which isn't as straightforward for SSO users as it is for local users.
The RPC in tshd already returns an error if it detects that the user is an SSO user, however the Electron app was still showing the UI to everybody.
Checking for an SSO user is done by grabbing
GetUserType()
from a user resource we get from the cluster on calls toGetCluster
and then returning it withLoggedInUser
, next to ACL.UserTypeFromString
was based onResourceDeviceEnrollStatusFromString
.