-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7977671
commit 3c92235
Showing
1 changed file
with
18 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,10 @@ function isLibrariesContentType(object: any): object is LibrariesContentType { | |
return 'h5p_libraries' in object; | ||
} | ||
|
||
function isUserType(object: any): object is IUser { | ||
return true; | ||
} | ||
|
||
@Injectable() | ||
export class H5PLibraryManagementService { | ||
contentTypeCache: ContentTypeCache; | ||
|
@@ -98,9 +102,20 @@ export class H5PLibraryManagementService { | |
if (contentType === undefined) { | ||
throw new NotFoundException('this library does not exist'); | ||
} | ||
const user: IUser = { canUpdateAndInstallLibraries: true } as IUser; | ||
await this.contentTypeRepo.installContentType(librariesToInstall[lastPositionLibrariesToInstallArray], user); | ||
await this.installLibraries(librariesToInstall.slice(0, lastPositionLibrariesToInstallArray)); | ||
const userObj = { | ||
canCreateRestricted: true, | ||
canInstallRecommended: true, | ||
canUpdateAndInstallLibraries: true, | ||
email: '[email protected]', | ||
id: 'a', | ||
name: 'a', | ||
type: 'local', | ||
}; | ||
if (isUserType(userObj)) { | ||
const user: IUser = userObj; | ||
await this.contentTypeRepo.installContentType(librariesToInstall[lastPositionLibrariesToInstallArray], user); | ||
await this.installLibraries(librariesToInstall.slice(0, lastPositionLibrariesToInstallArray)); | ||
} | ||
} | ||
|
||
public async run(): Promise<void> { | ||
|