src/lib/service/capabilities/capabilities.service.ts
Handles the systems capabilities. Capabilities are settings that enable/disable certain client features.
Methods |
getCapabilities |
getCapabilities()
|
Getter for the Capabilities
Returns :
Capabilities
|
hasCapability | ||||||||
hasCapability(capability: string)
|
||||||||
Check if Capability is present
Parameters :
Returns :
boolean
True if the capability is set, false otherwise |
setCapabilities | ||||||||||||
setCapabilities(userCapabilities: any, useSingleSingOn?: boolean)
|
||||||||||||
Sets the capabilities based on a given object set by auth.service
Parameters :
Returns :
Capabilities
The newly created capabilities object |
As yuuvis® RAD provides the concept of capabilities
this service will handle their setup and their
current state. [Provided Capabilities]{interfaces/Capabilities.html}.
import {Injectable} from '@angular/core';
import {Capabilities} from './capabilities.model';
import {SystemService} from '../system/system.service';
/**
* Handles the systems capabilities. Capabilities are settings that enable/disable certain client features.
*/
@Injectable({
providedIn: 'root'
})
export class CapabilitiesService {
private capabilities: Capabilities;
/**
* @ignore
*/
constructor(private system: SystemService) {
}
/**
* Sets the capabilities based on a given object set by auth.service
*
* @param userCapabilities Object containing capabilities properties
* @param useSingleSingOn Whether or not to set up single signon on capability
* @returns The newly created capabilities object
*/
setCapabilities(userCapabilities: any, useSingleSingOn?: boolean): Capabilities {
this.capabilities = {
bpm: userCapabilities.bpm,
favorites: userCapabilities.favorites,
followup: userCapabilities.followup,
subscription: userCapabilities.subscription,
intray: userCapabilities.intray,
storedqueries: userCapabilities.storedqueries,
recyclebin: userCapabilities.recyclebin,
inbox: userCapabilities.bpm || userCapabilities.followup || userCapabilities.subscription,
notifications: userCapabilities.followup || userCapabilities.subscription,
template: userCapabilities.template,
sso: useSingleSingOn || false,
};
return this.capabilities;
}
/**
* Getter for the Capabilities
*/
getCapabilities(): Capabilities {
return {...this.capabilities, signing: !!this.system.getObjectType('yuvsigning')};
}
/**
* Check if Capability is present
* @param capability Capability to check for
* @returns True if the capability is set, false otherwise
*/
hasCapability(capability: string): boolean {
return this.capabilities[capability];
}
}