Skip to content

Commit

Permalink
Work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
clarktsiory committed Apr 19, 2024
1 parent a16969f commit b0ef705
Showing 1 changed file with 47 additions and 0 deletions.
@@ -0,0 +1,47 @@
package com.normation.rudder.rest.internal

import com.normation.errors.IOResult
import com.normation.rudder.api.ApiVersion
import com.normation.rudder.apidata.JsonResponseObjects.*
import com.normation.rudder.facts.nodes.QueryContext
import com.normation.rudder.repository.RoNodeGroupRepository
import com.normation.rudder.rest.ApiModuleProvider
import com.normation.rudder.rest.ApiPath
import com.normation.rudder.rest.AuthzToken
import com.normation.rudder.rest.GroupInternalApi as API
import com.normation.rudder.rest.implicits.*
import com.normation.rudder.rest.lift.*
import net.liftweb.http.Req

class GroupsInternalApi(
groupsInternalApiService: GroupsInternalApiService
) extends LiftApiModuleProvider[API] {

def schemas: ApiModuleProvider[API] = API

def getLiftEndpoints(): List[LiftApiModule] = {
API.endpoints.map(e => {
e match {
case API.GetGroupCategoryTree => GetGroupCategoryTree
}
})
}

object GetGroupCategoryTree extends LiftApiModule0 {
val schema: API.GetGroupCategoryTree.type = API.GetGroupCategoryTree

def process0(version: ApiVersion, path: ApiPath, req: Req, params: DefaultParams, authzToken: AuthzToken): LiftResponse = {
implicit val qc: QueryContext = authzToken.qc
groupsInternalApiService.getGroupCategoryTree().toLiftResponseOne(params, schema, _ => None)
}
}

}

class GroupsInternalApiService(
readGroup: RoNodeGroupRepository
) {
def getGroupCategoryTree()(implicit qc: QueryContext): IOResult[JRGroupCategoryInfo] = {
???
}
}

0 comments on commit b0ef705

Please sign in to comment.