started implementing api
This commit is contained in:
@@ -4,28 +4,18 @@ import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"acooldomain.co/backend/auth"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
)
|
||||
|
||||
type Permission int
|
||||
|
||||
const (
|
||||
Start Permission = 1 << iota
|
||||
Stop
|
||||
Browse
|
||||
Create
|
||||
Delete
|
||||
RunCommand
|
||||
Admin
|
||||
)
|
||||
|
||||
type User struct {
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
MaxOwnedServers int `json:"maxed_owned_servers"`
|
||||
Permissions []string `json:"permissions"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
MaxOwnedServers int `json:"maxed_owned_servers"`
|
||||
Permissions auth.Permission `json:"permissions"`
|
||||
HashedPass auth.Permission `json:"hashedPass"`
|
||||
}
|
||||
|
||||
type Connection struct {
|
||||
@@ -50,5 +40,5 @@ func (con Connection) GetUsers(c *gin.Context) {
|
||||
|
||||
func LoadGroup(group *gin.RouterGroup, client *mongo.Client) {
|
||||
connection := Connection{connection: client}
|
||||
group.GET("/", connection.GetUsers)
|
||||
group.Use(auth.AuthorizedTo(0)).GET("/", connection.GetUsers)
|
||||
}
|
||||
|
Reference in New Issue
Block a user