forked from labring/laf
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Showing
10 changed files
with
76 additions
and
215 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
@token={{login.response.body.$.data.access_token}} | ||
|
||
### 管理员登陆 | ||
# @name login | ||
|
||
POST {{base_url}}/admin/login HTTP/1.1 | ||
Content-Type: application/json | ||
|
||
{ | ||
"username": "{{sys_admin}}", | ||
"password": "{{sys_password}}" | ||
} | ||
|
||
|
||
### 部署访问策略 | ||
|
||
POST {{base_url}}/deploy/policy | ||
Content-Type: application/json;charset=UTF-8 | ||
Authorization: Bearer {{token}} |
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
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,36 @@ | ||
import * as express from 'express' | ||
import { checkPermission } from '../../api/permission' | ||
import { deployAccessPolicy } from '../../api/rules' | ||
import { Globals } from '../../lib/globals' | ||
|
||
const logger = Globals.logger | ||
export const DeployRouter = express.Router() | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
DeployRouter.post('/policy', async (req, res) => { | ||
const requestId = req['requestId'] | ||
logger.info(requestId, `post /deploy/policy`) | ||
|
||
// 权限验证 | ||
const code = await checkPermission(req['auth']?.uid, 'deploy.policy') | ||
if (code) { | ||
return res.status(code).send() | ||
} | ||
|
||
try { | ||
const r = await deployAccessPolicy() | ||
|
||
return res.send({ | ||
code: 0, | ||
data: r | ||
}) | ||
} catch (error) { | ||
return res.send({ | ||
code: 1, | ||
error: error | ||
}) | ||
} | ||
}) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.