Hi guys,
After some time checking the code and doing some changes, i started looking into admin pages (which is basically the global ban part which i'm interested in).
It is located in Areas > Admin, as this image shows:, where you can find controllers, views, etc.
It is also registered in RouteConfig.cs inside Areas>Admin as:
public static void RegisterRoutes(IRouteBuilder routes)
{
RerouteDefaultArea(routes, "Admin", VoatSettings.Instance.AreaMaps, new { controller = "Spam", action = "Ban" });
}
so the url is yourdomain.com/Spam/Ban
When i tried to enter on that URL with a non global permission user, i got this error, so i created a new user called GlobalAdmin and i put global admin permissions in database.
So, when i try to enter to that URL with my GlobalAdmin (which have Global Admin roles in database) i'm not redirected to the error url and the spam controller is reached., but i got an exception
{System.InvalidOperationException: The view 'Ban' was not found. The following locations were searched:
/Views/Spam/Ban.cshtml
/Views/Shared/Ban.cshtml
So, to speed up things, i just copy and paste the Areas/Admin/Views/Spam/Ban.cshtml folder to Views/Spam/Ban.cshtml
Now i can ban users and domains (and delegate this to other people). Hope you found this useful, and of course if you have another way to do it please let me know!
view the rest of the comments →
[–] emboole [S] 0 points 1 point 1 point (+1|-0) ago
Hey @huslenuujii As i promised like one or two months ago, this may be helpful!
[–] huslenuujii 0 points 1 point 1 point (+1|-0) ago
wow really good job , its so really helpful for me!
[–] emboole [S] ago
I'm glad you found it helpful! the only issue is anyone with global ban "powers" can ban even global admins. There are two ways to fix this: the correct one and the fast one. The correct one is to check the range and if the range is >= don't ban (or even auto ban). The fast one is an if with hardcoded user names, and, why not, an auto ban.
If you got any issue regarding the db reply and i'll put it detailed.