strapi-plugin-magic-sessionmanager 4.5.4 → 4.5.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/dist/server/index.js +67 -40
- package/dist/server/index.mjs +67 -40
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -10776,17 +10776,26 @@ var contentApi$1 = {
|
|
|
10776
10776
|
}
|
|
10777
10777
|
]
|
|
10778
10778
|
};
|
|
10779
|
+
const PLUGIN_ACCESS_ACTION = "plugin::magic-sessionmanager.access";
|
|
10780
|
+
const adminPolicy = () => [
|
|
10781
|
+
"admin::isAuthenticatedAdmin",
|
|
10782
|
+
{
|
|
10783
|
+
name: "admin::hasPermissions",
|
|
10784
|
+
config: { actions: [PLUGIN_ACCESS_ACTION] }
|
|
10785
|
+
}
|
|
10786
|
+
];
|
|
10779
10787
|
const isDevEnvironment = (() => {
|
|
10780
10788
|
const env2 = (process.env.NODE_ENV || "development").toLowerCase();
|
|
10781
10789
|
return env2 !== "production" && env2 !== "staging";
|
|
10782
10790
|
})();
|
|
10783
10791
|
const baseRoutes = [
|
|
10792
|
+
// ============================ SESSIONS ============================
|
|
10784
10793
|
{
|
|
10785
10794
|
method: "GET",
|
|
10786
10795
|
path: "/sessions",
|
|
10787
10796
|
handler: "session.getAllSessionsAdmin",
|
|
10788
10797
|
config: {
|
|
10789
|
-
policies:
|
|
10798
|
+
policies: adminPolicy(),
|
|
10790
10799
|
description: "Get all sessions - active and inactive (admin)"
|
|
10791
10800
|
}
|
|
10792
10801
|
},
|
|
@@ -10795,7 +10804,7 @@ const baseRoutes = [
|
|
|
10795
10804
|
path: "/sessions/active",
|
|
10796
10805
|
handler: "session.getActiveSessions",
|
|
10797
10806
|
config: {
|
|
10798
|
-
policies:
|
|
10807
|
+
policies: adminPolicy(),
|
|
10799
10808
|
description: "Get only active sessions (admin)"
|
|
10800
10809
|
}
|
|
10801
10810
|
},
|
|
@@ -10804,8 +10813,8 @@ const baseRoutes = [
|
|
|
10804
10813
|
path: "/user/:userId/sessions",
|
|
10805
10814
|
handler: "session.getUserSessions",
|
|
10806
10815
|
config: {
|
|
10807
|
-
policies:
|
|
10808
|
-
description: "Get user
|
|
10816
|
+
policies: adminPolicy(),
|
|
10817
|
+
description: "Get sessions for a specific user (admin)"
|
|
10809
10818
|
}
|
|
10810
10819
|
},
|
|
10811
10820
|
{
|
|
@@ -10813,7 +10822,7 @@ const baseRoutes = [
|
|
|
10813
10822
|
path: "/sessions/:sessionId/terminate",
|
|
10814
10823
|
handler: "session.terminateSingleSession",
|
|
10815
10824
|
config: {
|
|
10816
|
-
policies:
|
|
10825
|
+
policies: adminPolicy(),
|
|
10817
10826
|
description: "Terminate a specific session (admin)"
|
|
10818
10827
|
}
|
|
10819
10828
|
},
|
|
@@ -10822,7 +10831,7 @@ const baseRoutes = [
|
|
|
10822
10831
|
path: "/sessions/:sessionId",
|
|
10823
10832
|
handler: "session.deleteSession",
|
|
10824
10833
|
config: {
|
|
10825
|
-
policies:
|
|
10834
|
+
policies: adminPolicy(),
|
|
10826
10835
|
description: "Delete a single session permanently (admin)"
|
|
10827
10836
|
}
|
|
10828
10837
|
},
|
|
@@ -10831,7 +10840,7 @@ const baseRoutes = [
|
|
|
10831
10840
|
path: "/sessions/clean-inactive",
|
|
10832
10841
|
handler: "session.cleanInactiveSessions",
|
|
10833
10842
|
config: {
|
|
10834
|
-
policies:
|
|
10843
|
+
policies: adminPolicy(),
|
|
10835
10844
|
description: "Delete all inactive sessions from database (admin)"
|
|
10836
10845
|
}
|
|
10837
10846
|
},
|
|
@@ -10840,7 +10849,7 @@ const baseRoutes = [
|
|
|
10840
10849
|
path: "/user/:userId/terminate-all",
|
|
10841
10850
|
handler: "session.terminateAllUserSessions",
|
|
10842
10851
|
config: {
|
|
10843
|
-
policies:
|
|
10852
|
+
policies: adminPolicy(),
|
|
10844
10853
|
description: "Terminate all sessions for a user (admin)"
|
|
10845
10854
|
}
|
|
10846
10855
|
},
|
|
@@ -10849,56 +10858,74 @@ const baseRoutes = [
|
|
|
10849
10858
|
path: "/user/:userId/toggle-block",
|
|
10850
10859
|
handler: "session.toggleUserBlock",
|
|
10851
10860
|
config: {
|
|
10852
|
-
policies:
|
|
10861
|
+
policies: adminPolicy(),
|
|
10853
10862
|
description: "Toggle user blocked status (admin)"
|
|
10854
10863
|
}
|
|
10855
10864
|
},
|
|
10865
|
+
// ============================ LICENSE ============================
|
|
10856
10866
|
{
|
|
10857
10867
|
method: "GET",
|
|
10858
10868
|
path: "/license/status",
|
|
10859
10869
|
handler: "license.getStatus",
|
|
10860
|
-
config: {
|
|
10870
|
+
config: {
|
|
10871
|
+
policies: adminPolicy(),
|
|
10872
|
+
description: "Get license status (admin)"
|
|
10873
|
+
}
|
|
10861
10874
|
},
|
|
10862
10875
|
{
|
|
10863
10876
|
method: "POST",
|
|
10864
10877
|
path: "/license/auto-create",
|
|
10865
10878
|
handler: "license.autoCreate",
|
|
10866
|
-
config: {
|
|
10879
|
+
config: {
|
|
10880
|
+
policies: adminPolicy(),
|
|
10881
|
+
description: "Auto-create license for current admin (admin)"
|
|
10882
|
+
}
|
|
10867
10883
|
},
|
|
10868
10884
|
{
|
|
10869
10885
|
method: "POST",
|
|
10870
10886
|
path: "/license/create",
|
|
10871
10887
|
handler: "license.createAndActivate",
|
|
10872
|
-
config: {
|
|
10888
|
+
config: {
|
|
10889
|
+
policies: adminPolicy(),
|
|
10890
|
+
description: "Create and activate a new license (admin)"
|
|
10891
|
+
}
|
|
10873
10892
|
},
|
|
10874
10893
|
{
|
|
10875
10894
|
method: "POST",
|
|
10876
10895
|
path: "/license/ping",
|
|
10877
10896
|
handler: "license.ping",
|
|
10878
|
-
config: {
|
|
10897
|
+
config: {
|
|
10898
|
+
policies: adminPolicy(),
|
|
10899
|
+
description: "Ping the license server (admin)"
|
|
10900
|
+
}
|
|
10879
10901
|
},
|
|
10880
10902
|
{
|
|
10881
10903
|
method: "POST",
|
|
10882
10904
|
path: "/license/store-key",
|
|
10883
10905
|
handler: "license.storeKey",
|
|
10884
|
-
config: {
|
|
10906
|
+
config: {
|
|
10907
|
+
policies: adminPolicy(),
|
|
10908
|
+
description: "Store a license key (admin)"
|
|
10909
|
+
}
|
|
10885
10910
|
},
|
|
10911
|
+
// ============================ GEOLOCATION ============================
|
|
10886
10912
|
{
|
|
10887
10913
|
method: "GET",
|
|
10888
10914
|
path: "/geolocation/:ipAddress",
|
|
10889
10915
|
handler: "session.getIpGeolocation",
|
|
10890
10916
|
config: {
|
|
10891
|
-
policies:
|
|
10892
|
-
description: "Get IP geolocation data (Premium feature)"
|
|
10917
|
+
policies: adminPolicy(),
|
|
10918
|
+
description: "Get IP geolocation data (Premium feature, admin)"
|
|
10893
10919
|
}
|
|
10894
10920
|
},
|
|
10921
|
+
// ============================ SETTINGS ============================
|
|
10895
10922
|
{
|
|
10896
10923
|
method: "GET",
|
|
10897
10924
|
path: "/settings",
|
|
10898
10925
|
handler: "settings.getSettings",
|
|
10899
10926
|
config: {
|
|
10900
|
-
policies:
|
|
10901
|
-
description: "Get plugin settings"
|
|
10927
|
+
policies: adminPolicy(),
|
|
10928
|
+
description: "Get plugin settings (admin)"
|
|
10902
10929
|
}
|
|
10903
10930
|
},
|
|
10904
10931
|
{
|
|
@@ -10906,8 +10933,8 @@ const baseRoutes = [
|
|
|
10906
10933
|
path: "/settings",
|
|
10907
10934
|
handler: "settings.updateSettings",
|
|
10908
10935
|
config: {
|
|
10909
|
-
policies:
|
|
10910
|
-
description: "Update plugin settings"
|
|
10936
|
+
policies: adminPolicy(),
|
|
10937
|
+
description: "Update plugin settings (admin)"
|
|
10911
10938
|
}
|
|
10912
10939
|
}
|
|
10913
10940
|
];
|
|
@@ -10917,8 +10944,8 @@ const devOnlyRoutes = [
|
|
|
10917
10944
|
path: "/sessions/:sessionId/simulate-timeout",
|
|
10918
10945
|
handler: "session.simulateTimeout",
|
|
10919
10946
|
config: {
|
|
10920
|
-
policies:
|
|
10921
|
-
description: "Simulate session timeout (dev-only)"
|
|
10947
|
+
policies: adminPolicy(),
|
|
10948
|
+
description: "Simulate session timeout (dev-only, admin)"
|
|
10922
10949
|
}
|
|
10923
10950
|
}
|
|
10924
10951
|
];
|
|
@@ -11140,7 +11167,7 @@ var session$3 = {
|
|
|
11140
11167
|
};
|
|
11141
11168
|
} catch (err) {
|
|
11142
11169
|
strapi.log.error("[magic-sessionmanager] getAllSessionsAdmin error:", err);
|
|
11143
|
-
ctx.
|
|
11170
|
+
return ctx.internalServerError("Error fetching sessions");
|
|
11144
11171
|
}
|
|
11145
11172
|
},
|
|
11146
11173
|
/**
|
|
@@ -11157,7 +11184,7 @@ var session$3 = {
|
|
|
11157
11184
|
};
|
|
11158
11185
|
} catch (err) {
|
|
11159
11186
|
strapi.log.error("[magic-sessionmanager] getActiveSessions error:", err);
|
|
11160
|
-
ctx.
|
|
11187
|
+
return ctx.internalServerError("Error fetching active sessions");
|
|
11161
11188
|
}
|
|
11162
11189
|
},
|
|
11163
11190
|
/**
|
|
@@ -11207,7 +11234,7 @@ var session$3 = {
|
|
|
11207
11234
|
};
|
|
11208
11235
|
} catch (err) {
|
|
11209
11236
|
strapi.log.error("[magic-sessionmanager] Error fetching own sessions:", err);
|
|
11210
|
-
ctx.
|
|
11237
|
+
return ctx.internalServerError("Error fetching sessions");
|
|
11211
11238
|
}
|
|
11212
11239
|
},
|
|
11213
11240
|
/**
|
|
@@ -11238,7 +11265,7 @@ var session$3 = {
|
|
|
11238
11265
|
};
|
|
11239
11266
|
} catch (err) {
|
|
11240
11267
|
strapi.log.error("[magic-sessionmanager] getUserSessions error:", err);
|
|
11241
|
-
ctx.
|
|
11268
|
+
return ctx.internalServerError("Error fetching user sessions");
|
|
11242
11269
|
}
|
|
11243
11270
|
},
|
|
11244
11271
|
/**
|
|
@@ -11272,12 +11299,12 @@ var session$3 = {
|
|
|
11272
11299
|
strapi.log.info(`[magic-sessionmanager] User ${userDocId} logged out (session ${matchingSession.documentId})`);
|
|
11273
11300
|
}
|
|
11274
11301
|
ctx.body = {
|
|
11275
|
-
message: "Logged out successfully",
|
|
11302
|
+
message: terminated ? "Logged out successfully" : "No active session found — you are already logged out",
|
|
11276
11303
|
terminated
|
|
11277
11304
|
};
|
|
11278
11305
|
} catch (err) {
|
|
11279
11306
|
strapi.log.error("[magic-sessionmanager] Logout error:", err);
|
|
11280
|
-
ctx.
|
|
11307
|
+
return ctx.internalServerError("Error during logout");
|
|
11281
11308
|
}
|
|
11282
11309
|
},
|
|
11283
11310
|
/**
|
|
@@ -11311,7 +11338,7 @@ var session$3 = {
|
|
|
11311
11338
|
};
|
|
11312
11339
|
} catch (err) {
|
|
11313
11340
|
strapi.log.error("[magic-sessionmanager] Logout-all error:", err);
|
|
11314
|
-
ctx.
|
|
11341
|
+
return ctx.internalServerError("Error during logout");
|
|
11315
11342
|
}
|
|
11316
11343
|
},
|
|
11317
11344
|
/**
|
|
@@ -11371,7 +11398,7 @@ var session$3 = {
|
|
|
11371
11398
|
};
|
|
11372
11399
|
} catch (err) {
|
|
11373
11400
|
strapi.log.error("[magic-sessionmanager] Logout-others error:", err);
|
|
11374
|
-
ctx.
|
|
11401
|
+
return ctx.internalServerError("Error terminating other sessions");
|
|
11375
11402
|
}
|
|
11376
11403
|
},
|
|
11377
11404
|
/**
|
|
@@ -11429,7 +11456,7 @@ var session$3 = {
|
|
|
11429
11456
|
};
|
|
11430
11457
|
} catch (err) {
|
|
11431
11458
|
strapi.log.error("[magic-sessionmanager] Error getting current session:", err);
|
|
11432
|
-
ctx.
|
|
11459
|
+
return ctx.internalServerError("Error fetching current session");
|
|
11433
11460
|
}
|
|
11434
11461
|
},
|
|
11435
11462
|
/**
|
|
@@ -11476,7 +11503,7 @@ var session$3 = {
|
|
|
11476
11503
|
};
|
|
11477
11504
|
} catch (err) {
|
|
11478
11505
|
strapi.log.error("[magic-sessionmanager] Error terminating own session:", err);
|
|
11479
|
-
ctx.
|
|
11506
|
+
return ctx.internalServerError("Error terminating session");
|
|
11480
11507
|
}
|
|
11481
11508
|
},
|
|
11482
11509
|
/**
|
|
@@ -11512,7 +11539,7 @@ var session$3 = {
|
|
|
11512
11539
|
};
|
|
11513
11540
|
} catch (err) {
|
|
11514
11541
|
strapi.log.error("[magic-sessionmanager] Error simulating timeout:", err);
|
|
11515
|
-
ctx.
|
|
11542
|
+
return ctx.internalServerError("Error simulating session timeout");
|
|
11516
11543
|
}
|
|
11517
11544
|
},
|
|
11518
11545
|
/**
|
|
@@ -11529,7 +11556,7 @@ var session$3 = {
|
|
|
11529
11556
|
};
|
|
11530
11557
|
} catch (err) {
|
|
11531
11558
|
strapi.log.error("[magic-sessionmanager] Error terminating session:", err);
|
|
11532
|
-
ctx.
|
|
11559
|
+
return ctx.internalServerError("Error terminating session");
|
|
11533
11560
|
}
|
|
11534
11561
|
},
|
|
11535
11562
|
/**
|
|
@@ -11546,7 +11573,7 @@ var session$3 = {
|
|
|
11546
11573
|
};
|
|
11547
11574
|
} catch (err) {
|
|
11548
11575
|
strapi.log.error("[magic-sessionmanager] Error terminating all user sessions:", err);
|
|
11549
|
-
ctx.
|
|
11576
|
+
return ctx.internalServerError("Error terminating all user sessions");
|
|
11550
11577
|
}
|
|
11551
11578
|
},
|
|
11552
11579
|
/**
|
|
@@ -11594,7 +11621,7 @@ var session$3 = {
|
|
|
11594
11621
|
};
|
|
11595
11622
|
} catch (err) {
|
|
11596
11623
|
strapi.log.error("[magic-sessionmanager] Error getting IP geolocation:", err);
|
|
11597
|
-
ctx.
|
|
11624
|
+
return ctx.internalServerError("Error fetching IP geolocation data");
|
|
11598
11625
|
}
|
|
11599
11626
|
},
|
|
11600
11627
|
/**
|
|
@@ -11611,7 +11638,7 @@ var session$3 = {
|
|
|
11611
11638
|
};
|
|
11612
11639
|
} catch (err) {
|
|
11613
11640
|
strapi.log.error("[magic-sessionmanager] Error deleting session:", err);
|
|
11614
|
-
ctx.
|
|
11641
|
+
return ctx.internalServerError("Error deleting session");
|
|
11615
11642
|
}
|
|
11616
11643
|
},
|
|
11617
11644
|
/**
|
|
@@ -11628,7 +11655,7 @@ var session$3 = {
|
|
|
11628
11655
|
};
|
|
11629
11656
|
} catch (err) {
|
|
11630
11657
|
strapi.log.error("[magic-sessionmanager] Error cleaning inactive sessions:", err);
|
|
11631
|
-
ctx.
|
|
11658
|
+
return ctx.internalServerError("Error deleting inactive sessions");
|
|
11632
11659
|
}
|
|
11633
11660
|
},
|
|
11634
11661
|
/**
|
|
@@ -11670,7 +11697,7 @@ var session$3 = {
|
|
|
11670
11697
|
};
|
|
11671
11698
|
} catch (err) {
|
|
11672
11699
|
strapi.log.error("[magic-sessionmanager] Error toggling user block:", err);
|
|
11673
|
-
ctx.
|
|
11700
|
+
return ctx.internalServerError("Error toggling user block status");
|
|
11674
11701
|
}
|
|
11675
11702
|
}
|
|
11676
11703
|
};
|
|
@@ -12672,7 +12699,7 @@ var session$1 = ({ strapi: strapi2 }) => {
|
|
|
12672
12699
|
}
|
|
12673
12700
|
};
|
|
12674
12701
|
};
|
|
12675
|
-
const version$1 = "4.5.
|
|
12702
|
+
const version$1 = "4.5.5";
|
|
12676
12703
|
const require$$2 = {
|
|
12677
12704
|
version: version$1
|
|
12678
12705
|
};
|
package/dist/server/index.mjs
CHANGED
|
@@ -10763,17 +10763,26 @@ var contentApi$1 = {
|
|
|
10763
10763
|
}
|
|
10764
10764
|
]
|
|
10765
10765
|
};
|
|
10766
|
+
const PLUGIN_ACCESS_ACTION = "plugin::magic-sessionmanager.access";
|
|
10767
|
+
const adminPolicy = () => [
|
|
10768
|
+
"admin::isAuthenticatedAdmin",
|
|
10769
|
+
{
|
|
10770
|
+
name: "admin::hasPermissions",
|
|
10771
|
+
config: { actions: [PLUGIN_ACCESS_ACTION] }
|
|
10772
|
+
}
|
|
10773
|
+
];
|
|
10766
10774
|
const isDevEnvironment = (() => {
|
|
10767
10775
|
const env2 = (process.env.NODE_ENV || "development").toLowerCase();
|
|
10768
10776
|
return env2 !== "production" && env2 !== "staging";
|
|
10769
10777
|
})();
|
|
10770
10778
|
const baseRoutes = [
|
|
10779
|
+
// ============================ SESSIONS ============================
|
|
10771
10780
|
{
|
|
10772
10781
|
method: "GET",
|
|
10773
10782
|
path: "/sessions",
|
|
10774
10783
|
handler: "session.getAllSessionsAdmin",
|
|
10775
10784
|
config: {
|
|
10776
|
-
policies:
|
|
10785
|
+
policies: adminPolicy(),
|
|
10777
10786
|
description: "Get all sessions - active and inactive (admin)"
|
|
10778
10787
|
}
|
|
10779
10788
|
},
|
|
@@ -10782,7 +10791,7 @@ const baseRoutes = [
|
|
|
10782
10791
|
path: "/sessions/active",
|
|
10783
10792
|
handler: "session.getActiveSessions",
|
|
10784
10793
|
config: {
|
|
10785
|
-
policies:
|
|
10794
|
+
policies: adminPolicy(),
|
|
10786
10795
|
description: "Get only active sessions (admin)"
|
|
10787
10796
|
}
|
|
10788
10797
|
},
|
|
@@ -10791,8 +10800,8 @@ const baseRoutes = [
|
|
|
10791
10800
|
path: "/user/:userId/sessions",
|
|
10792
10801
|
handler: "session.getUserSessions",
|
|
10793
10802
|
config: {
|
|
10794
|
-
policies:
|
|
10795
|
-
description: "Get user
|
|
10803
|
+
policies: adminPolicy(),
|
|
10804
|
+
description: "Get sessions for a specific user (admin)"
|
|
10796
10805
|
}
|
|
10797
10806
|
},
|
|
10798
10807
|
{
|
|
@@ -10800,7 +10809,7 @@ const baseRoutes = [
|
|
|
10800
10809
|
path: "/sessions/:sessionId/terminate",
|
|
10801
10810
|
handler: "session.terminateSingleSession",
|
|
10802
10811
|
config: {
|
|
10803
|
-
policies:
|
|
10812
|
+
policies: adminPolicy(),
|
|
10804
10813
|
description: "Terminate a specific session (admin)"
|
|
10805
10814
|
}
|
|
10806
10815
|
},
|
|
@@ -10809,7 +10818,7 @@ const baseRoutes = [
|
|
|
10809
10818
|
path: "/sessions/:sessionId",
|
|
10810
10819
|
handler: "session.deleteSession",
|
|
10811
10820
|
config: {
|
|
10812
|
-
policies:
|
|
10821
|
+
policies: adminPolicy(),
|
|
10813
10822
|
description: "Delete a single session permanently (admin)"
|
|
10814
10823
|
}
|
|
10815
10824
|
},
|
|
@@ -10818,7 +10827,7 @@ const baseRoutes = [
|
|
|
10818
10827
|
path: "/sessions/clean-inactive",
|
|
10819
10828
|
handler: "session.cleanInactiveSessions",
|
|
10820
10829
|
config: {
|
|
10821
|
-
policies:
|
|
10830
|
+
policies: adminPolicy(),
|
|
10822
10831
|
description: "Delete all inactive sessions from database (admin)"
|
|
10823
10832
|
}
|
|
10824
10833
|
},
|
|
@@ -10827,7 +10836,7 @@ const baseRoutes = [
|
|
|
10827
10836
|
path: "/user/:userId/terminate-all",
|
|
10828
10837
|
handler: "session.terminateAllUserSessions",
|
|
10829
10838
|
config: {
|
|
10830
|
-
policies:
|
|
10839
|
+
policies: adminPolicy(),
|
|
10831
10840
|
description: "Terminate all sessions for a user (admin)"
|
|
10832
10841
|
}
|
|
10833
10842
|
},
|
|
@@ -10836,56 +10845,74 @@ const baseRoutes = [
|
|
|
10836
10845
|
path: "/user/:userId/toggle-block",
|
|
10837
10846
|
handler: "session.toggleUserBlock",
|
|
10838
10847
|
config: {
|
|
10839
|
-
policies:
|
|
10848
|
+
policies: adminPolicy(),
|
|
10840
10849
|
description: "Toggle user blocked status (admin)"
|
|
10841
10850
|
}
|
|
10842
10851
|
},
|
|
10852
|
+
// ============================ LICENSE ============================
|
|
10843
10853
|
{
|
|
10844
10854
|
method: "GET",
|
|
10845
10855
|
path: "/license/status",
|
|
10846
10856
|
handler: "license.getStatus",
|
|
10847
|
-
config: {
|
|
10857
|
+
config: {
|
|
10858
|
+
policies: adminPolicy(),
|
|
10859
|
+
description: "Get license status (admin)"
|
|
10860
|
+
}
|
|
10848
10861
|
},
|
|
10849
10862
|
{
|
|
10850
10863
|
method: "POST",
|
|
10851
10864
|
path: "/license/auto-create",
|
|
10852
10865
|
handler: "license.autoCreate",
|
|
10853
|
-
config: {
|
|
10866
|
+
config: {
|
|
10867
|
+
policies: adminPolicy(),
|
|
10868
|
+
description: "Auto-create license for current admin (admin)"
|
|
10869
|
+
}
|
|
10854
10870
|
},
|
|
10855
10871
|
{
|
|
10856
10872
|
method: "POST",
|
|
10857
10873
|
path: "/license/create",
|
|
10858
10874
|
handler: "license.createAndActivate",
|
|
10859
|
-
config: {
|
|
10875
|
+
config: {
|
|
10876
|
+
policies: adminPolicy(),
|
|
10877
|
+
description: "Create and activate a new license (admin)"
|
|
10878
|
+
}
|
|
10860
10879
|
},
|
|
10861
10880
|
{
|
|
10862
10881
|
method: "POST",
|
|
10863
10882
|
path: "/license/ping",
|
|
10864
10883
|
handler: "license.ping",
|
|
10865
|
-
config: {
|
|
10884
|
+
config: {
|
|
10885
|
+
policies: adminPolicy(),
|
|
10886
|
+
description: "Ping the license server (admin)"
|
|
10887
|
+
}
|
|
10866
10888
|
},
|
|
10867
10889
|
{
|
|
10868
10890
|
method: "POST",
|
|
10869
10891
|
path: "/license/store-key",
|
|
10870
10892
|
handler: "license.storeKey",
|
|
10871
|
-
config: {
|
|
10893
|
+
config: {
|
|
10894
|
+
policies: adminPolicy(),
|
|
10895
|
+
description: "Store a license key (admin)"
|
|
10896
|
+
}
|
|
10872
10897
|
},
|
|
10898
|
+
// ============================ GEOLOCATION ============================
|
|
10873
10899
|
{
|
|
10874
10900
|
method: "GET",
|
|
10875
10901
|
path: "/geolocation/:ipAddress",
|
|
10876
10902
|
handler: "session.getIpGeolocation",
|
|
10877
10903
|
config: {
|
|
10878
|
-
policies:
|
|
10879
|
-
description: "Get IP geolocation data (Premium feature)"
|
|
10904
|
+
policies: adminPolicy(),
|
|
10905
|
+
description: "Get IP geolocation data (Premium feature, admin)"
|
|
10880
10906
|
}
|
|
10881
10907
|
},
|
|
10908
|
+
// ============================ SETTINGS ============================
|
|
10882
10909
|
{
|
|
10883
10910
|
method: "GET",
|
|
10884
10911
|
path: "/settings",
|
|
10885
10912
|
handler: "settings.getSettings",
|
|
10886
10913
|
config: {
|
|
10887
|
-
policies:
|
|
10888
|
-
description: "Get plugin settings"
|
|
10914
|
+
policies: adminPolicy(),
|
|
10915
|
+
description: "Get plugin settings (admin)"
|
|
10889
10916
|
}
|
|
10890
10917
|
},
|
|
10891
10918
|
{
|
|
@@ -10893,8 +10920,8 @@ const baseRoutes = [
|
|
|
10893
10920
|
path: "/settings",
|
|
10894
10921
|
handler: "settings.updateSettings",
|
|
10895
10922
|
config: {
|
|
10896
|
-
policies:
|
|
10897
|
-
description: "Update plugin settings"
|
|
10923
|
+
policies: adminPolicy(),
|
|
10924
|
+
description: "Update plugin settings (admin)"
|
|
10898
10925
|
}
|
|
10899
10926
|
}
|
|
10900
10927
|
];
|
|
@@ -10904,8 +10931,8 @@ const devOnlyRoutes = [
|
|
|
10904
10931
|
path: "/sessions/:sessionId/simulate-timeout",
|
|
10905
10932
|
handler: "session.simulateTimeout",
|
|
10906
10933
|
config: {
|
|
10907
|
-
policies:
|
|
10908
|
-
description: "Simulate session timeout (dev-only)"
|
|
10934
|
+
policies: adminPolicy(),
|
|
10935
|
+
description: "Simulate session timeout (dev-only, admin)"
|
|
10909
10936
|
}
|
|
10910
10937
|
}
|
|
10911
10938
|
];
|
|
@@ -11127,7 +11154,7 @@ var session$3 = {
|
|
|
11127
11154
|
};
|
|
11128
11155
|
} catch (err) {
|
|
11129
11156
|
strapi.log.error("[magic-sessionmanager] getAllSessionsAdmin error:", err);
|
|
11130
|
-
ctx.
|
|
11157
|
+
return ctx.internalServerError("Error fetching sessions");
|
|
11131
11158
|
}
|
|
11132
11159
|
},
|
|
11133
11160
|
/**
|
|
@@ -11144,7 +11171,7 @@ var session$3 = {
|
|
|
11144
11171
|
};
|
|
11145
11172
|
} catch (err) {
|
|
11146
11173
|
strapi.log.error("[magic-sessionmanager] getActiveSessions error:", err);
|
|
11147
|
-
ctx.
|
|
11174
|
+
return ctx.internalServerError("Error fetching active sessions");
|
|
11148
11175
|
}
|
|
11149
11176
|
},
|
|
11150
11177
|
/**
|
|
@@ -11194,7 +11221,7 @@ var session$3 = {
|
|
|
11194
11221
|
};
|
|
11195
11222
|
} catch (err) {
|
|
11196
11223
|
strapi.log.error("[magic-sessionmanager] Error fetching own sessions:", err);
|
|
11197
|
-
ctx.
|
|
11224
|
+
return ctx.internalServerError("Error fetching sessions");
|
|
11198
11225
|
}
|
|
11199
11226
|
},
|
|
11200
11227
|
/**
|
|
@@ -11225,7 +11252,7 @@ var session$3 = {
|
|
|
11225
11252
|
};
|
|
11226
11253
|
} catch (err) {
|
|
11227
11254
|
strapi.log.error("[magic-sessionmanager] getUserSessions error:", err);
|
|
11228
|
-
ctx.
|
|
11255
|
+
return ctx.internalServerError("Error fetching user sessions");
|
|
11229
11256
|
}
|
|
11230
11257
|
},
|
|
11231
11258
|
/**
|
|
@@ -11259,12 +11286,12 @@ var session$3 = {
|
|
|
11259
11286
|
strapi.log.info(`[magic-sessionmanager] User ${userDocId} logged out (session ${matchingSession.documentId})`);
|
|
11260
11287
|
}
|
|
11261
11288
|
ctx.body = {
|
|
11262
|
-
message: "Logged out successfully",
|
|
11289
|
+
message: terminated ? "Logged out successfully" : "No active session found — you are already logged out",
|
|
11263
11290
|
terminated
|
|
11264
11291
|
};
|
|
11265
11292
|
} catch (err) {
|
|
11266
11293
|
strapi.log.error("[magic-sessionmanager] Logout error:", err);
|
|
11267
|
-
ctx.
|
|
11294
|
+
return ctx.internalServerError("Error during logout");
|
|
11268
11295
|
}
|
|
11269
11296
|
},
|
|
11270
11297
|
/**
|
|
@@ -11298,7 +11325,7 @@ var session$3 = {
|
|
|
11298
11325
|
};
|
|
11299
11326
|
} catch (err) {
|
|
11300
11327
|
strapi.log.error("[magic-sessionmanager] Logout-all error:", err);
|
|
11301
|
-
ctx.
|
|
11328
|
+
return ctx.internalServerError("Error during logout");
|
|
11302
11329
|
}
|
|
11303
11330
|
},
|
|
11304
11331
|
/**
|
|
@@ -11358,7 +11385,7 @@ var session$3 = {
|
|
|
11358
11385
|
};
|
|
11359
11386
|
} catch (err) {
|
|
11360
11387
|
strapi.log.error("[magic-sessionmanager] Logout-others error:", err);
|
|
11361
|
-
ctx.
|
|
11388
|
+
return ctx.internalServerError("Error terminating other sessions");
|
|
11362
11389
|
}
|
|
11363
11390
|
},
|
|
11364
11391
|
/**
|
|
@@ -11416,7 +11443,7 @@ var session$3 = {
|
|
|
11416
11443
|
};
|
|
11417
11444
|
} catch (err) {
|
|
11418
11445
|
strapi.log.error("[magic-sessionmanager] Error getting current session:", err);
|
|
11419
|
-
ctx.
|
|
11446
|
+
return ctx.internalServerError("Error fetching current session");
|
|
11420
11447
|
}
|
|
11421
11448
|
},
|
|
11422
11449
|
/**
|
|
@@ -11463,7 +11490,7 @@ var session$3 = {
|
|
|
11463
11490
|
};
|
|
11464
11491
|
} catch (err) {
|
|
11465
11492
|
strapi.log.error("[magic-sessionmanager] Error terminating own session:", err);
|
|
11466
|
-
ctx.
|
|
11493
|
+
return ctx.internalServerError("Error terminating session");
|
|
11467
11494
|
}
|
|
11468
11495
|
},
|
|
11469
11496
|
/**
|
|
@@ -11499,7 +11526,7 @@ var session$3 = {
|
|
|
11499
11526
|
};
|
|
11500
11527
|
} catch (err) {
|
|
11501
11528
|
strapi.log.error("[magic-sessionmanager] Error simulating timeout:", err);
|
|
11502
|
-
ctx.
|
|
11529
|
+
return ctx.internalServerError("Error simulating session timeout");
|
|
11503
11530
|
}
|
|
11504
11531
|
},
|
|
11505
11532
|
/**
|
|
@@ -11516,7 +11543,7 @@ var session$3 = {
|
|
|
11516
11543
|
};
|
|
11517
11544
|
} catch (err) {
|
|
11518
11545
|
strapi.log.error("[magic-sessionmanager] Error terminating session:", err);
|
|
11519
|
-
ctx.
|
|
11546
|
+
return ctx.internalServerError("Error terminating session");
|
|
11520
11547
|
}
|
|
11521
11548
|
},
|
|
11522
11549
|
/**
|
|
@@ -11533,7 +11560,7 @@ var session$3 = {
|
|
|
11533
11560
|
};
|
|
11534
11561
|
} catch (err) {
|
|
11535
11562
|
strapi.log.error("[magic-sessionmanager] Error terminating all user sessions:", err);
|
|
11536
|
-
ctx.
|
|
11563
|
+
return ctx.internalServerError("Error terminating all user sessions");
|
|
11537
11564
|
}
|
|
11538
11565
|
},
|
|
11539
11566
|
/**
|
|
@@ -11581,7 +11608,7 @@ var session$3 = {
|
|
|
11581
11608
|
};
|
|
11582
11609
|
} catch (err) {
|
|
11583
11610
|
strapi.log.error("[magic-sessionmanager] Error getting IP geolocation:", err);
|
|
11584
|
-
ctx.
|
|
11611
|
+
return ctx.internalServerError("Error fetching IP geolocation data");
|
|
11585
11612
|
}
|
|
11586
11613
|
},
|
|
11587
11614
|
/**
|
|
@@ -11598,7 +11625,7 @@ var session$3 = {
|
|
|
11598
11625
|
};
|
|
11599
11626
|
} catch (err) {
|
|
11600
11627
|
strapi.log.error("[magic-sessionmanager] Error deleting session:", err);
|
|
11601
|
-
ctx.
|
|
11628
|
+
return ctx.internalServerError("Error deleting session");
|
|
11602
11629
|
}
|
|
11603
11630
|
},
|
|
11604
11631
|
/**
|
|
@@ -11615,7 +11642,7 @@ var session$3 = {
|
|
|
11615
11642
|
};
|
|
11616
11643
|
} catch (err) {
|
|
11617
11644
|
strapi.log.error("[magic-sessionmanager] Error cleaning inactive sessions:", err);
|
|
11618
|
-
ctx.
|
|
11645
|
+
return ctx.internalServerError("Error deleting inactive sessions");
|
|
11619
11646
|
}
|
|
11620
11647
|
},
|
|
11621
11648
|
/**
|
|
@@ -11657,7 +11684,7 @@ var session$3 = {
|
|
|
11657
11684
|
};
|
|
11658
11685
|
} catch (err) {
|
|
11659
11686
|
strapi.log.error("[magic-sessionmanager] Error toggling user block:", err);
|
|
11660
|
-
ctx.
|
|
11687
|
+
return ctx.internalServerError("Error toggling user block status");
|
|
11661
11688
|
}
|
|
11662
11689
|
}
|
|
11663
11690
|
};
|
|
@@ -12659,7 +12686,7 @@ var session$1 = ({ strapi: strapi2 }) => {
|
|
|
12659
12686
|
}
|
|
12660
12687
|
};
|
|
12661
12688
|
};
|
|
12662
|
-
const version$1 = "4.5.
|
|
12689
|
+
const version$1 = "4.5.5";
|
|
12663
12690
|
const require$$2 = {
|
|
12664
12691
|
version: version$1
|
|
12665
12692
|
};
|
package/package.json
CHANGED