[ACA-3729] Join library action for Admin Users (#1801)

This commit is contained in:
davidcanonieto
2020-11-23 15:07:12 +00:00
committed by GitHub
parent 8186ee16ac
commit b504a224ea
8 changed files with 102 additions and 14 deletions

View File

@@ -26,6 +26,7 @@
import { RuleContext } from '@alfresco/adf-extensions';
import * as navigation from './navigation.rules';
import * as repository from './repository.rules';
import { isAdmin } from './user.rules';
export interface AcaRuleContext extends RuleContext {
withCredentials: boolean;
@@ -81,7 +82,10 @@ export function canShareFile(context: RuleContext): boolean {
* JSON ref: `canToggleJoinLibrary`
*/
export function canToggleJoinLibrary(context: RuleContext): boolean {
return [hasLibrarySelected(context), !isPrivateLibrary(context), hasNoLibraryRole(context)].every(Boolean);
return (
[hasLibrarySelected(context), !isPrivateLibrary(context), hasNoLibraryRole(context)].every(Boolean) ||
[hasLibrarySelected(context), isPrivateLibrary(context), hasNoLibraryRole(context), isAdmin(context)].every(Boolean)
);
}
/**

View File

@@ -31,7 +31,8 @@ export enum LibraryActionTypes {
Create = 'CREATE_LIBRARY',
Navigate = 'NAVIGATE_LIBRARY',
Update = 'UPDATE_LIBRARY',
Leave = 'LEAVE_LIBRARY'
Leave = 'LEAVE_LIBRARY',
Reload = 'RELOAD_LIBRARY'
}
export class DeleteLibraryAction implements Action {
@@ -61,3 +62,6 @@ export class LeaveLibraryAction implements Action {
constructor(public payload?: string) {}
}
export class ReloadLibraryAction implements Action {
readonly type = LibraryActionTypes.Reload;
}