2016-08-07 12:58:20 +00:00
|
|
|
import * as plugins from "./smartsocket.plugins";
|
|
|
|
|
2016-08-07 16:59:39 +00:00
|
|
|
// import classes
|
2016-08-08 16:20:00 +00:00
|
|
|
import { Objectmap } from "lik";
|
|
|
|
import { SocketFunction } from "./smartsocket.classes.socketfunction";
|
|
|
|
|
|
|
|
|
|
|
|
export let allSocketRoles = new Objectmap<SocketRole>();
|
|
|
|
|
2016-08-07 16:59:39 +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 {
|
2016-08-08 16:20:00 +00:00
|
|
|
name: string;
|
|
|
|
passwordHash: string;
|
2016-08-07 13:37:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A socketrole defines access to certain routines.
|
|
|
|
*/
|
|
|
|
export class SocketRole {
|
2016-08-08 16:20:00 +00:00
|
|
|
name: string;
|
|
|
|
passwordHash: string;
|
|
|
|
allowedFunctions = new Objectmap<SocketFunction>();
|
|
|
|
constructor(optionsArg: SocketRoleOptions) {
|
2016-08-07 13:37:52 +00:00
|
|
|
this.name = optionsArg.name;
|
|
|
|
this.passwordHash = optionsArg.passwordHash;
|
2016-08-08 16:20:00 +00:00
|
|
|
allSocketRoles.add(this);
|
|
|
|
};
|
|
|
|
addSocketFunction(socketFunctionArg:SocketFunction){
|
|
|
|
this.allowedFunctions.add(socketFunctionArg);
|
2016-08-07 12:58:20 +00:00
|
|
|
}
|
|
|
|
}
|