2018-03-15 01:29:40 +00:00
|
|
|
import * as plugins from './smartsocket.plugins';
|
2016-08-07 12:58:20 +00:00
|
|
|
|
2016-08-07 16:59:39 +00:00
|
|
|
// import classes
|
2019-01-30 02:14:02 +00:00
|
|
|
import { Objectmap } from '@pushrocks/lik';
|
2018-03-15 01:29:40 +00:00
|
|
|
import { SocketFunction } from './smartsocket.classes.socketfunction';
|
2016-08-08 16:20:00 +00:00
|
|
|
|
2016-08-07 12:58:20 +00:00
|
|
|
/**
|
2016-08-07 13:37:52 +00:00
|
|
|
* interface for class SocketRole
|
2016-08-07 12:58:20 +00:00
|
|
|
*/
|
2016-08-07 13:37:52 +00:00
|
|
|
export interface SocketRoleOptions {
|
2018-03-15 01:29:40 +00:00
|
|
|
name: string;
|
|
|
|
passwordHash: string;
|
2016-08-07 13:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A socketrole defines access to certain routines.
|
|
|
|
*/
|
|
|
|
export class SocketRole {
|
2018-03-15 01:29:40 +00:00
|
|
|
name: string;
|
|
|
|
passwordHash: string;
|
|
|
|
allowedFunctions = new Objectmap<SocketFunction>();
|
|
|
|
constructor(optionsArg: SocketRoleOptions) {
|
|
|
|
this.name = optionsArg.name;
|
|
|
|
this.passwordHash = optionsArg.passwordHash;
|
|
|
|
}
|
|
|
|
addSocketFunction(socketFunctionArg: SocketFunction) {
|
|
|
|
this.allowedFunctions.add(socketFunctionArg);
|
|
|
|
}
|
|
|
|
}
|