forked from Normation/rudder
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a16969f
commit b0ef705
Showing
1 changed file
with
47 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
...der/rudder-rest/src/main/scala/com/normation/rudder/rest/internal/GroupsInternalAPI.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] = { | ||
??? | ||
} | ||
} |