Friends Notification

Starting Group Create Notification...
This commit is contained in:
Paolo Arena
2022-07-28 21:47:23 +02:00
parent 50c6031789
commit 7cda5dbb8b
8 changed files with 85 additions and 46 deletions

View File

@@ -230,12 +230,12 @@ router.post('/settable', authenticate, async (req, res) => {
try {
if (User.isAdmin(req.user.perm) || User.isManager(req.user.perm) ||
User.isEditor(req.user.perm) || User.isTutor(req.user.perm)) {
User.isEditor(req.user.perm) || User.isFacilitatore(req.user.perm)) {
consentito = true;
}
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm) &&
!User.isEditor(req.user.perm) && !User.isTutor(req.user.perm)) &&
!User.isEditor(req.user.perm) && !User.isFacilitatore(req.user.perm)) &&
!tools.ModificheConsentite(params.table, fieldsvalue)) {
// If without permissions, exit
return res.status(404).
@@ -355,6 +355,12 @@ router.post('/settable', authenticate, async (req, res) => {
setnotif = true;
}
if (shared_consts.TABLES_GROUPS_NOTIFICATION.includes(params.table)) {
typedir = shared_consts.TypeNotifs.TYPEDIR_GROUPS;
typeid = shared_consts.TypeNotifs.ID_GROUP_NEW_REC;
setnotif = true;
}
if (setnotif) {
SendNotif.createNewNotification(req, res, params.table, myrec, typedir, typeid);
}
@@ -475,7 +481,7 @@ router.post('/getexp', authenticate, (req, res) => {
}
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm) &&
!User.isTutor(req.user.perm))) {
!User.isFacilitatore(req.user.perm))) {
// If without permissions, exit
return res.status(404).
send({code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: ''});
@@ -591,7 +597,7 @@ router.patch('/chval', authenticate, async (req, res) => {
// If I change my record...
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm) &&
!User.isEditor(req.user.perm) && !User.isTutor(req.user.perm)) &&
!User.isEditor(req.user.perm) && !User.isFacilitatore(req.user.perm)) &&
(req.user._id.toString() !== id) &&
!tools.ModificheConsentite(mydata.table, fieldsvalue)) {
// If without permissions, exit
@@ -798,7 +804,7 @@ router.patch('/askfunz', authenticate, async (req, res) => {
if (!entra) {
// If I change my record...
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm) &&
!User.isTutor(req.user.perm)) && (req.user._id.toString() !== id)) {
!User.isFacilitatore(req.user.perm)) && (req.user._id.toString() !== id)) {
// If without permissions, exit
return res.status(404).
send({code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: ''});
@@ -854,7 +860,7 @@ router.patch('/callfunz', authenticate, async (req, res) => {
if (!entra) {
// If I change my record...
if ((!User.isAdmin(req.user.perm) && !User.isManager(req.user.perm) &&
!User.isTutor(req.user.perm)) && (req.user._id.toString() !== id)) {
!User.isFacilitatore(req.user.perm)) && (req.user._id.toString() !== id)) {
// If without permissions, exit
return res.status(404).
send({code: server_constants.RIS_CODE_ERR_UNAUTHORIZED, msg: ''});