|
|
@@ -12,9 +12,20 @@ exports.cekSatuDataLaporan = async (
|
|
|
const w = { _id: laporan_id, aktif: where.aktif || true, ...where }
|
|
|
switch (user.role.id) {
|
|
|
case 2020:
|
|
|
- if (where.all) break
|
|
|
- else if (!where.delegasi) w.role_data = 'dikti'
|
|
|
- else {
|
|
|
+ if (where.all) {
|
|
|
+ w.role_asal = 'dikti'
|
|
|
+ // w['$or'] = [
|
|
|
+ // { role_asal : 'dikti' },
|
|
|
+ // { role_asal: 'lldikti', role_data: 'dikti' },
|
|
|
+ // ]
|
|
|
+ } else if (!where.delegasi) {
|
|
|
+ w.role_data = 'dikti'
|
|
|
+ } else if (!where.delegasi) {
|
|
|
+ w['$or'] = [
|
|
|
+ { role_asal: 'dikti' },
|
|
|
+ { role_asal: 'lldikti', role_data: 'dikti' },
|
|
|
+ ]
|
|
|
+ } else {
|
|
|
w.role_data = 'lldikti'
|
|
|
w.role_asal = 'dikti'
|
|
|
}
|
|
|
@@ -54,9 +65,15 @@ exports.cekBanyakDataLaporan = async (user, where = { delegasi: false }) => {
|
|
|
const w = { aktif: where.aktif || true, ...where }
|
|
|
switch (user.role.id) {
|
|
|
case 2020:
|
|
|
- if (where.all) break
|
|
|
- else if (!where.delegasi) w.role_data = 'dikti'
|
|
|
- else {
|
|
|
+ if (where.all) {
|
|
|
+ w.role_asal = 'dikti'
|
|
|
+ // w['$or'] = [
|
|
|
+ // { role_asal : 'dikti' },
|
|
|
+ // { role_asal: 'lldikti', role_data: 'dikti' },
|
|
|
+ // ]
|
|
|
+ } else if (!where.delegasi) {
|
|
|
+ w.role_data = 'dikti'
|
|
|
+ } else {
|
|
|
w.role_data = 'lldikti'
|
|
|
w.role_asal = 'dikti'
|
|
|
}
|