Initial commit
This commit is contained in:
25
api/hooks/medialib/delete_delete.js
Normal file
25
api/hooks/medialib/delete_delete.js
Normal file
@@ -0,0 +1,25 @@
|
||||
const { withAccount } = require("../lib/utils")
|
||||
;(function () {
|
||||
if (context.user.auth()) return {}
|
||||
withAccount((login) => {
|
||||
const id = context.request().param("id")
|
||||
const user = context.db.find("bigCommerceCustomer", {
|
||||
filter: {
|
||||
$or: [
|
||||
{
|
||||
"personalRecords.recording": id,
|
||||
},
|
||||
{
|
||||
"personalRecords.thumbnail": id,
|
||||
},
|
||||
],
|
||||
},
|
||||
})[0]
|
||||
if (login.tibiId !== user.id) {
|
||||
return {
|
||||
status: 403,
|
||||
message: "You are not authorized to delete this media",
|
||||
}
|
||||
}
|
||||
})
|
||||
})()
|
||||
Reference in New Issue
Block a user