@jusbid/common-auth 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +8 -1
- package/package.json +1 -1
- package/scripts/permission.js +34 -0
package/index.js
CHANGED
|
@@ -126,6 +126,12 @@ const canAccess = ({ module, action }) => {
|
|
|
126
126
|
};
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
+
const authMandate = async (req, res, next) => {
|
|
130
|
+
if (!req.headers['x-user-id']) return res.json({ success: false, message: "Session Expired" });
|
|
131
|
+
next()
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
|
|
129
135
|
|
|
130
136
|
const getPermissionString = permissions;
|
|
131
137
|
const getQuestionSlug = questions;
|
|
@@ -137,5 +143,6 @@ module.exports = {
|
|
|
137
143
|
getQuestionSlug,
|
|
138
144
|
getPropertyMasterSlug,
|
|
139
145
|
notificationType,
|
|
140
|
-
roles
|
|
146
|
+
roles,
|
|
147
|
+
authMandate
|
|
141
148
|
};
|
package/package.json
CHANGED
package/scripts/permission.js
CHANGED
|
@@ -159,6 +159,40 @@ const permissions = {
|
|
|
159
159
|
STORAGE_PROVIDER_ADD: { action: "storage.storage-provider.add", module: "storage" },
|
|
160
160
|
STORAGE_PROVIDER_UPDATE: { action: "storage.storage-provider.update", module: "storage" },
|
|
161
161
|
STORAGE_PROVIDER_DELETE: { action: "storage.storage-provider.delete", module: "storage" },
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
TICKET_VIEW: { action: "customer-support.ticket.view", module: "customer-support" },
|
|
165
|
+
TICKET_CREATE: { action: "customer-support.ticket.create", module: "customer-support" },
|
|
166
|
+
TICKET_UPDATE: { action: "customer-support.ticket.update", module: "customer-support" },
|
|
167
|
+
TICKET_DELETE: { action: "customer-support.ticket.delete", module: "customer-support" },
|
|
168
|
+
|
|
169
|
+
BOT_VIEW: { action: "customer-support.bot.view", module: "customer-support" },
|
|
170
|
+
BOT_CREATE: { action: "customer-support.bot.create", module: "customer-support" },
|
|
171
|
+
BOT_UPDATE: { action: "customer-support.bot.update", module: "customer-support" },
|
|
172
|
+
BOT_DELETE: { action: "customer-support.bot.delete", module: "customer-support" },
|
|
173
|
+
|
|
174
|
+
CALL_VIEW: { action: "customer-support.call.view", module: "customer-support" },
|
|
175
|
+
CALL_CREATE: { action: "customer-support.call.create", module: "customer-support" },
|
|
176
|
+
CALL_UPDATE: { action: "customer-support.call.update", module: "customer-support" },
|
|
177
|
+
CALL_DELETE: { action: "customer-support.call.delete", module: "customer-support" },
|
|
178
|
+
|
|
179
|
+
CAMPAIGN_VIEW: { action: "customer-support.campaign.view", module: "customer-support" },
|
|
180
|
+
CAMPAIGN_CREATE: { action: "customer-support.campaign.create", module: "customer-support" },
|
|
181
|
+
CAMPAIGN_UPDATE: { action: "customer-support.campaign.update", module: "customer-support" },
|
|
182
|
+
CAMPAIGN_DELETE: { action: "customer-support.campaign.delete", module: "customer-support" },
|
|
183
|
+
|
|
184
|
+
LEAD_VIEW: { action: "customer-support.lead.view", module: "customer-support" },
|
|
185
|
+
LEAD_CREATE: { action: "customer-support.lead.create", module: "customer-support" },
|
|
186
|
+
LEAD_UPDATE: { action: "customer-support.lead.update", module: "customer-support" },
|
|
187
|
+
LEAD_DELETE: { action: "customer-support.lead.delete", module: "customer-support" },
|
|
188
|
+
|
|
189
|
+
MESSAGE_VIEW: { action: "customer-support.message.view", module: "customer-support" },
|
|
190
|
+
MESSAGE_CREATE: { action: "customer-support.message.create", module: "customer-support" },
|
|
191
|
+
MESSAGE_UPDATE: { action: "customer-support.message.update", module: "customer-support" },
|
|
192
|
+
MESSAGE_DELETE: { action: "customer-support.message.delete", module: "customer-support" },
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
162
196
|
}
|
|
163
197
|
|
|
164
198
|
module.exports = { permissions }
|