forked from danvega/solitary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModuleConfig.cfc
129 lines (106 loc) · 3.93 KB
/
ModuleConfig.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
component {
property name="installService" inject="model:installService@Solitary";
// Module Properties
this.title = "Solitary";
this.author = "Daniel Vega";
this.webURL = "http://www.danvega.org";
this.description = "A Security Module";
this.version = "0.1";
// If true, looks for views in the parent first, if not found, then in the module. Else vice-versa
this.viewParentLookup = true;
// If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa
this.layoutParentLookup = true;
// Module Entry Point
this.entryPoint = "security";
function configure(){
// parent settings
parentSettings = {
};
// module settings - stored in modules.name.settings
settings = {
// emails are sent from
sendEmailFrom = "admin@localhost"
};
// Layout Settings
layoutSettings = {
defaultLayout = "layout.security.cfm"
};
// datasources
datasources = {
};
// web services
webservices = {
};
// SES Routes
routes = [
{pattern="/", handler="security",action="index"},
{pattern="/docs", handler="docs",action="index"},
{pattern="/login", handler="security",action="login"},
{pattern="/doLogin", handler="security",action="doLogin"},
{pattern="/logout", handler="security",action="logout"},
{pattern="/forgotPassword", handler="security",action="forgotPassword"},
{pattern="/resetPassword/:eph", handler="security",action="resetPassword"},
{pattern="/changePassword", handler="security",action="changePassword"},
{pattern="/doChangePassword", handler="security",action="doChangePassword"},
{pattern="/accessDenied", handler="security",action="accessDenied"},
{pattern="/users/list", handler="users",action="list"},
{pattern="/users/list/role/:id", handler="users",action="list"},
{pattern="/users/edit/:id?", handler="users",action="edit"},
{pattern="/users/save", handler="users",action="save"},
{pattern="/users/remove/:id", handler="users",action="remove"},
{pattern="/users/usernameExists/:username", handler="users",action="usernameExists"},
{pattern="/roles/list", handler="roles",action="list"},
{pattern="/roles/edit/:id?", handler="roles",action="edit"},
{pattern="/roles/save", handler="roles",action="save"},
{pattern="/roles/remove/:id", handler="roles",action="remove"},
{pattern="/sessiontracking/current", handler="sessiontracking",action="current"},
{pattern="/sessiontracking/active", handler="sessiontracking",action="active"}
];
// Custom Declared Points
interceptorSettings = {
customInterceptionPoints = ""
};
// Custom Declared Interceptors
interceptors = [
//security
{class="coldbox.system.interceptors.security",
properties={
rulesSource="xml",
rulesFile="#modulePath#/config/securityRules.xml.cfm",
preEventSecurity="true",
validatorModel="securityService@Solitary"
}
}
];
// wirebox mappings
binder.map("SecurityService@Solitary")
.to("#moduleMapping#.model.security.SecurityService")
.asSingleton();
binder.map("UserService@Solitary")
.to("#moduleMapping#.model.users.UserService")
.asSingleton();
binder.map("RoleService@Solitary")
.to("#moduleMapping#.model.roles.RoleService")
.asSingleton();
binder.map("InstallService@Solitary")
.to("#moduleMapping#.model.install.Install")
.asSingleton();
}
/**
* Fired when the module is registered and activated.
*/
public void function onLoad(){
var setupPath = getDirectoryFromPath(getCurrentTemplatePath()) & "config\setup.xml";
var installService = binder.getInjector().getInstance("InstallService@Solitary");
// if a file named setup.xml exists in the config folder lets install some default data
if( fileExists(setupPath) ){
installService.setConfigPath(setupPath);
installService.setup();
}
}
/**
* Fired when the module is unregistered and unloaded
*/
public void function onUnload(){
}
}