[full-ci] disallow to share the personal drive via graph

This commit is contained in:
Roman Perekhod
2024-03-07 10:26:44 +01:00
parent 78b252a9d5
commit d7b66876a8
21 changed files with 108 additions and 182 deletions
+13 -2
View File
@@ -38,8 +38,13 @@ var (
)
// GetServiceUserContext returns an authenticated context of the given service user
// Deprecated: Use GetServiceUserContextWithContext()
func GetServiceUserContext(serviceUserID string, gwc gateway.GatewayAPIClient, serviceUserSecret string) (context.Context, error) {
ctx := context.Background()
return GetServiceUserContextWithContext(context.Background(), gwc, serviceUserID, serviceUserSecret)
}
// GetServiceUserContextWithContext returns an authenticated context of the given service user
func GetServiceUserContextWithContext(ctx context.Context, gwc gateway.GatewayAPIClient, serviceUserID string, serviceUserSecret string) (context.Context, error) {
authRes, err := gwc.Authenticate(ctx, &gateway.AuthenticateRequest{
Type: "serviceaccounts",
ClientId: serviceUserID,
@@ -57,8 +62,14 @@ func GetServiceUserContext(serviceUserID string, gwc gateway.GatewayAPIClient, s
}
// GetUser gets the specified user
// Deprecated: Use GetUserWithContext()
func GetUser(userID *user.UserId, gwc gateway.GatewayAPIClient) (*user.User, error) {
getUserResponse, err := gwc.GetUser(context.Background(), &user.GetUserRequest{UserId: userID})
return GetUserWithContext(context.Background(), userID, gwc)
}
// GetUserWithContext gets the specified user
func GetUserWithContext(ctx context.Context, userID *user.UserId, gwc gateway.GatewayAPIClient) (*user.User, error) {
getUserResponse, err := gwc.GetUser(ctx, &user.GetUserRequest{UserId: userID})
if err != nil {
return nil, err
}