const API = require("../../../lib/API")
const AccessControl = require("../../../lib/AccessControl")
const { BaseStdResponse } = require("../../../BaseStdResponse")

class GetPermissionPoints extends API {
    constructor() {
        super()
        this.setPath("/Admin/Permission/Points")
        this.setMethod("GET")
        this.setPermissionCode("action.user.permissionManage")
    }

    async onRequest(req, res) {
        const points = await AccessControl.getPermissionPoints()
        return res.json({
            ...BaseStdResponse.OK,
            data: points
        })
    }
}

module.exports.GetPermissionPoints = GetPermissionPoints
