mirror of
https://github.com/phishingclub/phishingclub.git
synced 2026-10-03 22:16:49 +02:00
add preemtive permission handlers
Signed-off-by: RonniSkansing <rskansing@gmail.com>
This commit is contained in:
3 files changed
+40
-5
No files matched your search
@@ -58,10 +58,13 @@ func (c *IPData) Remove(g *gin.Context) {
|
||||
|
||||
// SearchASN returns ASNs matching the query for the filter typeahead
|
||||
func (c *IPData) SearchASN(g *gin.Context) {
|
||||
_, _, ok := c.handleSession(g)
|
||||
session, _, ok := c.handleSession(g)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if !c.handleGlobalAuthorization(g, session) {
|
||||
return
|
||||
}
|
||||
q := g.Query("q")
|
||||
limit := 25
|
||||
if v := g.Query("limit"); v != "" {
|
||||
@@ -75,10 +78,13 @@ func (c *IPData) SearchASN(g *gin.Context) {
|
||||
|
||||
// LookupASN returns the autonomous systems that announce the given IP address
|
||||
func (c *IPData) LookupASN(g *gin.Context) {
|
||||
_, _, ok := c.handleSession(g)
|
||||
session, _, ok := c.handleSession(g)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if !c.handleGlobalAuthorization(g, session) {
|
||||
return
|
||||
}
|
||||
ip := g.Query("ip")
|
||||
if ip == "" {
|
||||
c.Response.BadRequest(g)
|
||||
@@ -102,10 +108,13 @@ type ResolveASNRequest struct {
|
||||
// ResolveASNs returns the details of the given ASNs that exist in the dataset.
|
||||
// ASNs that are absent are left out, which lets the UI flag orphaned entries.
|
||||
func (c *IPData) ResolveASNs(g *gin.Context) {
|
||||
_, _, ok := c.handleSession(g)
|
||||
session, _, ok := c.handleSession(g)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if !c.handleGlobalAuthorization(g, session) {
|
||||
return
|
||||
}
|
||||
var req ResolveASNRequest
|
||||
if ok := c.handleParseRequest(g, &req); !ok {
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user