Skip to content

Commit 1b65daf

Browse files
committed
removed become user feature
1 parent 4e217d8 commit 1b65daf

File tree

13 files changed

+2
-115
lines changed

13 files changed

+2
-115
lines changed

benchmark/request.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"default_s3_bucket": true,
1111
"support_tracking_domains": true,
1212
"telemetry_usage_disabled": false,
13-
"show_become_user": true,
1413
"docker_hub_id": "jitsu",
1514
"createDemoDatabase": true,
1615
"enableCustomDomains": true,

configurator/backend/authorization/firebase.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -182,26 +182,6 @@ func (fb *Firebase) AutoSignUp(ctx context.Context, email string, _ *string) (st
182182
return createdUser.UID, nil
183183
}
184184

185-
func (fb *Firebase) SignInAs(ctx context.Context, email string) (*openapi.TokenResponse, error) {
186-
user, err := fb.authClient.GetUserByEmail(ctx, email)
187-
if err != nil {
188-
return nil, middleware.ReadableError{
189-
Description: "Failed to get user from Firebase",
190-
Cause: err,
191-
}
192-
}
193-
194-
token, err := fb.authClient.CustomToken(ctx, user.UID)
195-
if err != nil {
196-
return nil, middleware.ReadableError{
197-
Description: "Failed to generate custom user token via Firebase",
198-
Cause: err,
199-
}
200-
}
201-
202-
return &openapi.TokenResponse{Token: token}, nil
203-
}
204-
205185
func isProvidedByGoogle(info []*auth.UserInfo) bool {
206186
for _, info := range info {
207187
if info.ProviderID == "google.com" {

configurator/backend/handlers/handlers.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ type LocalAuthorizator interface {
5050
GetUserIDByEmail(ctx context.Context, userEmail string) (string, error)
5151
}
5252

53-
type CloudAuthorizator interface {
54-
SignInAs(ctx context.Context, email string) (*openapi.TokenResponse, error)
55-
}
53+
type CloudAuthorizator interface{}
5654

5755
type SSOProvider interface {
5856
Name() string

configurator/backend/handlers/openapi.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -130,26 +130,6 @@ func (oa *OpenAPI) GenerateDefaultProjectApiKey(ctx *gin.Context) {
130130
}
131131
}
132132

133-
func (oa *OpenAPI) BecomeAnotherCloudUser(ctx *gin.Context, params openapi.BecomeAnotherCloudUserParams) {
134-
if ctx.IsAborted() {
135-
return
136-
}
137-
138-
if authorizator, err := oa.Authorizator.Cloud(); err != nil {
139-
mw.Unsupported(ctx, err)
140-
} else if authority, err := mw.GetAuthority(ctx); err != nil {
141-
mw.Unauthorized(ctx, err)
142-
} else if !authority.IsAdmin {
143-
mw.Forbidden(ctx, "Only admins can use this API method")
144-
} else if params.UserId == "" {
145-
mw.RequiredField(ctx, "user_id")
146-
} else if token, err := authorizator.SignInAs(ctx, params.UserId); err != nil {
147-
mw.BadRequest(ctx, "sign in failed", err)
148-
} else {
149-
ctx.JSON(http.StatusOK, token)
150-
}
151-
}
152-
153133
func (oa *OpenAPI) CreateFreeTierPostgresDatabase(ctx *gin.Context) {
154134
if ctx.IsAborted() {
155135
return
@@ -445,7 +425,6 @@ func (oa *OpenAPI) GetSystemConfiguration(ctx *gin.Context) {
445425
DefaultS3Bucket: !oa.SystemConfig.SelfHosted,
446426
SupportTrackingDomains: !oa.SystemConfig.SelfHosted,
447427
TelemetryUsageDisabled: telemetryUsageDisabled,
448-
ShowBecomeUser: !oa.SystemConfig.SelfHosted,
449428
DockerHubID: oa.SystemConfig.DockerHUBID,
450429
OnlyAdminCanChangeUserEmail: oa.SystemConfig.SelfHosted,
451430
Tag: oa.SystemConfig.Tag,

configurator/frontend/main/src/Layout.tsx

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ import { ReactComponent as KeyIcon } from "icons/key.svg"
2727
import { ReactComponent as DownloadIcon } from "icons/download.svg"
2828
import { ReactComponent as GlobeIcon } from "icons/globe.svg"
2929
import classNames from "classnames"
30-
// @Model
31-
import { Permission } from "lib/services/model"
3230
// @Utils
3331
import { reloadPage } from "lib/commons/utils"
3432
// @Services
@@ -235,20 +233,6 @@ export const DropdownMenu: React.FC<{ user: User; plan: CurrentSubscription; hid
235233

236234
const showSettings = React.useCallback<() => void>(() => history.push("/user/settings"), [history])
237235

238-
const becomeUser = async () => {
239-
let email = prompt("Please enter e-mail of the user", "")
240-
if (!email) {
241-
return
242-
}
243-
try {
244-
AnalyticsBlock.blockAll()
245-
await services.userService.becomeUser(email)
246-
} catch (e) {
247-
handleError(e, "Can't login as other user")
248-
AnalyticsBlock.unblockAll()
249-
}
250-
}
251-
252236
return (
253237
<div>
254238
<div className="py-5 border-b px-5 flex flex-col items-center">
@@ -292,12 +276,6 @@ export const DropdownMenu: React.FC<{ user: User; plan: CurrentSubscription; hid
292276
<Button type="text" className="text-left" key="settings" icon={<SettingOutlined />} onClick={showSettings}>
293277
Settings
294278
</Button>
295-
{(services.userService.getUser().email === "reg@ksense.io" ||
296-
services.userService.getUser().email.endsWith("@jitsu.com")) && (
297-
<Button className="text-left" type="text" key="become" icon={<UserSwitchOutlined />} onClick={becomeUser}>
298-
Become User
299-
</Button>
300-
)}
301279
<Button
302280
className="text-left"
303281
type="text"

configurator/frontend/main/src/lib/services/UserService.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ export interface UserService {
103103

104104
createUser(signup: SignupRequest): Promise<void>
105105

106-
becomeUser(email: string): Promise<void>
107-
108106
supportsLoginViaLink(): boolean
109107

110108
sendLoginLink(email: string): Promise<void>

configurator/frontend/main/src/lib/services/UserServiceBackend.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,6 @@ export class BackendUserService implements UserService {
181181
})
182182
}
183183

184-
//isn't supported (without google authorization)
185-
async becomeUser(email: string): Promise<void> {
186-
let response = await this.backendApi.get(`/become`, { urlParams: { user_id: email } })
187-
this.setTokens(response["access_token"], response["refresh_token"])
188-
reloadPage()
189-
}
190-
191184
getLoginFeatures(): LoginFeatures {
192185
return { oauth: false, password: true, signupEnabled: false }
193186
}

configurator/frontend/main/src/lib/services/UserServiceFirebase.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,6 @@ export class FirebaseUserService implements UserService {
203203
throw new Error("Not Available")
204204
}
205205

206-
async becomeUser(email: string): Promise<void> {
207-
let token = (await this.backendApi.get(`/become`, { urlParams: { user_id: email } }))["token"]
208-
await signInWithCustomToken(getAuth(), token)
209-
reloadPage()
210-
}
211-
212206
getLoginFeatures(): LoginFeatures {
213207
return { oauth: true, password: true, signupEnabled: true }
214208
}

configurator/frontend/main/src/lib/services/analytics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ function defaultExecutors(execs: AnalyticsExecutors): AnalyticsExecutors {
4141
}
4242

4343
/**
44-
* Allows to block all calls to any analytics service. For become user feature
44+
* Allows to block all calls to any analytics service
4545
*/
4646
export const AnalyticsBlock = {
4747
blockAll: () => {

configurator/frontend/main/src/lib/services/model.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ export type SuggestedUserInfo = {
3131
companyName?: string
3232
}
3333

34-
export enum Permission {
35-
BECOME_OTHER_USER,
36-
}
37-
3834
/**
3935
* User internal representation. This class is here for backward compatibility
4036
*/

0 commit comments

Comments
 (0)