mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 22:13:02 +00:00
CST-9639: Fixed error on control remove, fixed cancel button behavior, fixed bad state of access control tab on load, fixed translations, added jsdocs
This commit is contained in:
@@ -21,6 +21,9 @@ export interface BulkAccessPayload {
|
||||
itemAccess: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* This service is used to create a payload file and execute the bulk access control script
|
||||
*/
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class BulkAccessControlService {
|
||||
constructor(
|
||||
@@ -28,10 +31,13 @@ export class BulkAccessControlService {
|
||||
private router: Router,
|
||||
private scriptService: ScriptDataService,
|
||||
private translationService: TranslateService
|
||||
) {
|
||||
|
||||
}
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Create a payload file from the given payload and return the file and the url to the file
|
||||
* The created file will be used as input for the bulk access control script
|
||||
* @param payload The payload to create the file from
|
||||
*/
|
||||
createPayloadFile(payload: BulkAccessPayload) {
|
||||
const content = convertToBulkAccessControlFileModel(payload);
|
||||
|
||||
@@ -48,6 +54,11 @@ export class BulkAccessControlService {
|
||||
return { url, file };
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the bulk access control script with the given uuids and file
|
||||
* @param uuids
|
||||
* @param file
|
||||
*/
|
||||
executeScript(uuids: string[], file: File): Observable<boolean> {
|
||||
console.log('execute', { uuids, file });
|
||||
|
||||
@@ -80,6 +91,10 @@ export class BulkAccessControlService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given payload to a BulkAccessControlFileModel
|
||||
* @param payload
|
||||
*/
|
||||
export const convertToBulkAccessControlFileModel = (payload: { state: AccessControlFormState, bitstreamAccess: AccessCondition[], itemAccess: AccessCondition[] }): BulkAccessControlFileModel => {
|
||||
let finalPayload: BulkAccessControlFileModel = {};
|
||||
|
||||
|
Reference in New Issue
Block a user