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 6e7de43
Showing
5 changed files
with
137 additions
and
4 deletions.
There are no files selected for viewing
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
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
43 changes: 43 additions & 0 deletions
43
...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,43 @@ | ||
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.apidata.implicits.* | ||
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 io.scalaland.chimney.syntax.* | ||
import net.liftweb.http.LiftResponse | ||
import net.liftweb.http.Req | ||
|
||
class GroupsInternalApi( | ||
readGroup: RoNodeGroupRepository | ||
) 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 = { | ||
getGroupCategoryTree().toLiftResponseOne(params, schema, _ => None) | ||
} | ||
} | ||
|
||
def getGroupCategoryTree(): IOResult[JRGroupCategoryInfo] = { | ||
readGroup.getFullGroupLibrary().map(_.transformInto[JRGroupCategoryInfo]) | ||
} | ||
} |
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
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