Skip to content
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

Libs upgrade #718

Merged
merged 4 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,110 changes: 1,228 additions & 2,882 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"eslint-plugin-prettier": "^5.0.0",
"jest": "27.0.6",
"mocha": "^10.0.0",
"prettier": "^3.0.1",
"prettier": "^3.0.3",
"sinon": "^15.0.0",
"supertest": "^6.1.3",
"ts-jest": "^27.0.3",
Expand Down
5 changes: 2 additions & 3 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,8 @@ export class AppModule implements OnApplicationBootstrap {
};

try {
const createdProposal = await this.proposalsService.create(
proposal,
);
const createdProposal =
await this.proposalsService.create(proposal);
Logger.log(
`Proposal created/updated: ${createdProposal.proposalId}`,
"AppModule",
Expand Down
10 changes: 4 additions & 6 deletions src/auth/strategies/ldap.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@
username: user.username,
email: user.email,
};
const accessGroups = await this.accessGroupService.getAccessGroups(
userPayload,
);
const accessGroups =
await this.accessGroupService.getAccessGroups(userPayload);

const createUserIdentity: CreateUserIdentityDto = {
authStrategy: "ldap",
Expand Down Expand Up @@ -88,7 +87,7 @@

const foundUser = await this.usersService.findOne(userFilter);
const jsonUser = JSON.parse(JSON.stringify(foundUser));
const { password, ...user } = jsonUser;

Check warning on line 90 in src/auth/strategies/ldap.strategy.ts

View workflow job for this annotation

GitHub Actions / Unit tests

'password' is assigned a value but never used
user.userId = user._id;

// update user identity if needed
Expand All @@ -105,9 +104,8 @@
throw new Error("User identity does not exists!!!");
}
const userProfile = userIdentity.profile;
userProfile.accessGroups = await this.accessGroupService.getAccessGroups(
userPayload,
);
userProfile.accessGroups =
await this.accessGroupService.getAccessGroups(userPayload);
await this.usersService.updateUserIdentity(
{
profile: userProfile,
Expand Down
5 changes: 2 additions & 3 deletions src/auth/strategies/local.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ export class LocalStrategy extends PassportStrategy(Strategy) {
username: user.username,
email: user.email,
};
const accessGroups = await this.accessGroupService.getAccessGroups(
userPayload,
);
const accessGroups =
await this.accessGroupService.getAccessGroups(userPayload);

const userIdentity = await this.usersService.findByIdUserIdentity(user._id);
if (userIdentity === null) {
Expand Down
5 changes: 2 additions & 3 deletions src/auth/strategies/oidc.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@
accessGroupProperty: oidcConfig?.accessGroupProperty,
payload: userinfo,
};
userProfile.accessGroups = await this.accessGroupService.getAccessGroups(
userPayload,
);
userProfile.accessGroups =
await this.accessGroupService.getAccessGroups(userPayload);

const userFilter: FilterQuery<UserDocument> = {
$or: [
Expand Down Expand Up @@ -126,7 +125,7 @@
}

const jsonUser = JSON.parse(JSON.stringify(user));
const { password, ...returnUser } = jsonUser;

Check warning on line 128 in src/auth/strategies/oidc.strategy.ts

View workflow job for this annotation

GitHub Actions / Unit tests

'password' is assigned a value but never used
returnUser.userId = returnUser._id;

return returnUser;
Expand Down
5 changes: 2 additions & 3 deletions src/datasets/datasets.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1309,9 +1309,8 @@ export class DatasetsController {
accessGroups: dataset.accessGroups,
instrumentGroup: dataset.instrumentGroup,
};
const datablock = await this.origDatablocksService.create(
createOrigDatablock,
);
const datablock =
await this.origDatablocksService.create(createOrigDatablock);

const updateDatasetDto: PartialUpdateDatasetDto = {
size: dataset.size + datablock.size,
Expand Down
5 changes: 2 additions & 3 deletions src/instruments/instruments.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@ export class InstrumentsController {
@Body() createInstrumentDto: CreateInstrumentDto,
): Promise<Instrument> {
try {
const instrument = await this.instrumentsService.create(
createInstrumentDto,
);
const instrument =
await this.instrumentsService.create(createInstrumentDto);
return instrument;
} catch (e) {
throw new HttpException(
Expand Down
5 changes: 2 additions & 3 deletions src/origdatablocks/origdatablocks.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,8 @@ export class OrigDatablocksController {
// updates datasets size
const parsedFilters: IFilters<OrigDatablockDocument, IOrigDatablockFields> =
{ where: { datasetId: pid } };
const datasetOrigdatablocks = await this.origDatablocksService.findAll(
parsedFilters,
);
const datasetOrigdatablocks =
await this.origDatablocksService.findAll(parsedFilters);

const updateDatasetDto: PartialUpdateDatasetDto = {
size: datasetOrigdatablocks
Expand Down
5 changes: 2 additions & 3 deletions src/users/interceptors/create-user-settings.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ export class CreateUserSettingsInterceptor implements NestInterceptor {
return;
}
const userId = user._id;
const userSettings = await this.usersService.findByIdUserSettings(
userId,
);
const userSettings =
await this.usersService.findByIdUserSettings(userId);
if (!userSettings) {
Logger.log(
`Adding default settings to user ${user.username}`,
Expand Down
5 changes: 2 additions & 3 deletions src/users/user-identities.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,8 @@ export class UserIdentitiesController {
}

const authenticatedUser: JWTUser = request.user as JWTUser;
const ability = await this.caslAbilityFactory.createForUser(
authenticatedUser,
);
const ability =
await this.caslAbilityFactory.createForUser(authenticatedUser);

if (
!ability.can(Action.UserReadAny, User) &&
Expand Down
5 changes: 2 additions & 3 deletions src/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,8 @@ export class UsersController {
viewedUserSchema._id = viewedUserId;
viewedUserSchema.id = viewedUserId;

const ability = await this.caslAbilityFactory.createForUser(
authenticatedUser,
);
const ability =
await this.caslAbilityFactory.createForUser(authenticatedUser);
// const authorized = actions.map( action =>
// ability.can(action, viewedUserSchema)
// ) as Array<Boolean>;
Expand Down
Loading