package cn.ibizlab.api.rest.extensions;

import cn.ibizlab.core.extensions.service.UAACoreService;
import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class UAACoreResource {

    @Autowired
    private UAACoreService uaaCoreService;

    /**
     * 获取全部权限列表或菜单列表
     *
     * @return
     */
    @GetMapping(value = "/sys_permissions/getallMenuAndPermission")
    public ResponseEntity<JSONArray> getAllPermission() {
        JSONArray treeNode = new JSONArray();
        // 获取菜单
        treeNode.add(uaaCoreService.getAppMenu());
        //获取数据能力
        treeNode.add(uaaCoreService.getDEOppriv());

        return ResponseEntity.ok().body(treeNode);
    }

}
