Skip to content

Commit

Permalink
Use full path for import
Browse files Browse the repository at this point in the history
  • Loading branch information
fflorent committed Nov 26, 2024
1 parent 815c0de commit 798077a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions app/gen-server/lib/homedb/HomeDBManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,8 @@ export class HomeDBManager extends EventEmitter {
return this._usersManager.deleteUser(scope, userIdToDelete, name);
}

public async overrideUser(userId: number, props: UserProfile) {
return this._usersManager.overrideUser(userId, props);
public async overwriteUser(userId: number, props: UserProfile) {
return this._usersManager.overwriteUser(userId, props);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/gen-server/lib/homedb/UsersManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ export class UsersManager {
/**
* Update users with passed property. Optional user properties that are missing will be reset to their default value.
*/
public async overrideUser(userId: number, props: UserProfile): Promise<User> {
public async overwriteUser(userId: number, props: UserProfile): Promise<User> {
return await this._connection.transaction(async manager => {
const user = await this.getUser(userId, {includePrefs: true});
if (!user) { throw new ApiError("unable to find user to update", 404); }
Expand Down
4 changes: 2 additions & 2 deletions app/server/lib/scim/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as express from 'express';

import { buildScimRouterv2 } from './v2/ScimV2Api';
import { buildScimRouterv2 } from 'app/server/lib/scim/v2/ScimV2Api';
import { HomeDBManager } from 'app/gen-server/lib/homedb/HomeDBManager';
import { InstallAdmin } from '../InstallAdmin';
import { InstallAdmin } from 'app/server/lib/InstallAdmin';

const buildScimRouter = (dbManager: HomeDBManager, installAdmin: InstallAdmin) => {
const v2 = buildScimRouterv2(dbManager, installAdmin);
Expand Down
10 changes: 5 additions & 5 deletions app/server/lib/scim/v2/ScimUserController.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ApiError } from 'app/common/ApiError';
import { HomeDBManager, Scope } from 'app/gen-server/lib/homedb/HomeDBManager';
import SCIMMY from 'scimmy';
import { toSCIMMYUser, toUserProfile } from './ScimUserUtils';
import { RequestContext } from './ScimTypes';
import { toSCIMMYUser, toUserProfile } from 'app/server/lib/scim/v2/ScimUserUtils';
import { RequestContext } from 'app/server/lib/scim/v2/ScimTypes';
import log from 'app/server/lib/log';

class ScimUserController {
Expand Down Expand Up @@ -74,11 +74,11 @@ class ScimUserController {
* @param data The data to override the user with
* @param context The request context
*/
public async overrideUser(resource: any, data: any, context: RequestContext) {
public async overwriteUser(resource: any, data: any, context: RequestContext) {
return this._runAndHandleErrors(context, async () => {
const id = ScimUserController._getIdFromResource(resource);
await this._checkEmailCanBeUsed(data.userName, id);
const updatedUser = await this._dbManager.overrideUser(id, toUserProfile(data));
const updatedUser = await this._dbManager.overwriteUser(id, toUserProfile(data));
return toSCIMMYUser(updatedUser);
});
}
Expand Down Expand Up @@ -157,7 +157,7 @@ export const getScimUserConfig = (
},
ingress: async (resource: any, data: any, context: RequestContext) => {
if (resource.id) {
return await controller.overrideUser(resource, data, context);
return await controller.overwriteUser(resource, data, context);
}
return await controller.createUser(data, context);
},
Expand Down
4 changes: 2 additions & 2 deletions app/server/lib/scim/v2/ScimV2Api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import SCIMMY from "scimmy";
import SCIMMYRouters from "scimmy-routers";
import { RequestWithLogin } from 'app/server/lib/Authorizer';
import { InstallAdmin } from 'app/server/lib/InstallAdmin';
import { RequestContext } from './ScimTypes';
import { getScimUserConfig } from './ScimUserController';
import { RequestContext } from 'app/server/lib/scim/v2/ScimTypes';
import { getScimUserConfig } from 'app/server/lib/scim/v2/ScimUserController';

const WHITELISTED_PATHS_FOR_NON_ADMINS = [ "/Me", "/Schemas", "/ResourceTypes", "/ServiceProviderConfig" ];

Expand Down
2 changes: 1 addition & 1 deletion test/server/lib/Scim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ describe('Scim', () => {
sandbox.stub(getDbManager(), 'getUsers').throws(error);
sandbox.stub(getDbManager(), 'getUser').throws(error);
sandbox.stub(getDbManager(), 'getUserByLoginWithRetry').throws(error);
sandbox.stub(getDbManager(), 'overrideUser').throws(error);
sandbox.stub(getDbManager(), 'overwriteUser').throws(error);
sandbox.stub(getDbManager(), 'deleteUser').throws(error);

const res = await makeCallWith('chimpy');
Expand Down

0 comments on commit 798077a

Please sign in to comment.