nodebb-plugin-niki-loyalty 1.1.7 → 1.1.9
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/library.js +10 -1
- package/package.json +1 -1
package/library.js
CHANGED
|
@@ -362,9 +362,17 @@ Plugin.init = async function (params) {
|
|
|
362
362
|
// 8) ADMIN API - TÜM KULLANICILARIN PUANLARI
|
|
363
363
|
router.get('/api/niki-loyalty/admin/users', middleware.ensureLoggedIn, async (req, res) => {
|
|
364
364
|
try {
|
|
365
|
+
console.log('[Niki-Loyalty] Admin API called, uid:', req.uid);
|
|
366
|
+
|
|
365
367
|
const isAdmin = await user.isAdministrator(req.uid);
|
|
366
368
|
const isMod = await user.isGlobalModerator(req.uid);
|
|
367
|
-
|
|
369
|
+
|
|
370
|
+
console.log('[Niki-Loyalty] isAdmin:', isAdmin, 'isMod:', isMod);
|
|
371
|
+
|
|
372
|
+
if (!isAdmin && !isMod) {
|
|
373
|
+
console.log('[Niki-Loyalty] Access denied for uid:', req.uid);
|
|
374
|
+
return res.status(403).json({ error: 'Yetkisiz' });
|
|
375
|
+
}
|
|
368
376
|
|
|
369
377
|
// Tüm kullanıcıları al (limit 500)
|
|
370
378
|
const uids = await db.getSortedSetRange('users:joindate', 0, 499);
|
|
@@ -386,6 +394,7 @@ Plugin.init = async function (params) {
|
|
|
386
394
|
.filter(u => u.points > 0) // Sadece puanı olanlar
|
|
387
395
|
.sort((a, b) => b.points - a.points); // Yüksekten düşüğe sırala
|
|
388
396
|
|
|
397
|
+
console.log('[Niki-Loyalty] Returning', result.length, 'users');
|
|
389
398
|
return res.json(result);
|
|
390
399
|
} catch (err) {
|
|
391
400
|
console.error('[Niki-Loyalty] Admin users error:', err);
|