转自:http://redhacker.iteye.com/blog/1118676
用户管理系统接口文档
目录
一、角色定义
1. URI:/sys/{sysCode}/role/
(1)post
(2)get
2. URI:/sys/{sysCode}/role/deletebatch/
(1)post
3. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/
(1)put
(2)delete
4.URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/menu/
(1)post
(2)get
5. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/menu/{menuId:[\\w]{32}}/
(1)delete
6. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/menu/deletebatch/
(1)post
7. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/menu/exclude/
(1)get:
二、角色授权
1. URI:/sys/{sysCode}/role/
(1)get
2. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/post/
(2)post
3. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/post/{postId:[\\w]{32}}/
(1)delete
4. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/post/deletebatch/
(1)post
5. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/user/
(2)post
6. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/user/{userId:[\\w]{32}}/
(1)delete
7. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/user/deletebatch/
(1)post
8. URI:/post-user/
(1)get
9. URI:/post/
(1)get
10. URI:/user/
(1)get
三、资源授权
1. URI:/sys/
(1)get
2. URI:/sys/{sysCode}/resource/
(1)get
(2)post
3. URI:/sys/{sysCode}/resource/{resourceId:[\\w]{32}}/
(1)put
(2)delete
4. URI:/sys/{sysCode}/resource/deletebatch/
(1)post
四、系统授权
1. URI:/sys/
(1)get
(2)post
2. URI:/sys/{sysCode}/menu/
(1)post
(2)get
3. URI:/sys/{sysCode}/menu/deletebatch/
(1)post
4. URI:/sys/{sysCode}/menu/{menuId:[\\w]{32}}/
(1)get
(2)put
5. URI:/sys/{sysCode}/resource/
(1)get
修改记录 |
||
修订者 |
日期 |
备注 |
窦国强 |
2008.10.17 |
初建文档 |
一、角色定义
1. URI:/sys/{sysCode}/role/
(1)post
描述:增加一个角色到某系统(如质量系统)
Request message header:
Accept: application/json
Content-Type: application/json
Request message body:
{
name:张三, //角色名称
desc:取样人员 //角色描述
}
Response status:201
Response message header:
Content-type: application/json
Content-Location:http://www.jlerp.com/sys/001/role/001
Response message body:
{
uid:001,
name: 张三,
initCaptial: 'zhangsan',
desc:取样人员 //角色描述
}
(2)get
描述:获取所有角色
Request message header:
Accept: application/json
Cache-Control: max-age=300
Response status:200
Response message header:
Content-type: application/json
Cache-Control: max-age=300
Response message body:
{
roles:
[
{name:zhangsan,uid:001,initCaptial: 'zhangsan',desc:’’},
{name:zhangsan2,uid:002,initCaptial: 'zhangsan2',desc:’’},
{name:zhangsan3,uid:003,initCaptial: 'zhangsan3',desc:’’}
]
}
2. URI:/sys/{sysCode}/role/deletebatch/
(1)post
描述:从系统批量删除角色
Request message header:
Accept: application/json
Content-Type: application/json
Request message body:
{
Roles:[
{roleid:001},
{roleid:002}
]
}
Response status:204
Response message header:
Content-type: application/json
3. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/
(1)put
描述:修改角色/保存角色描述
Request message header:
Accept: application/json
Content-Type: application/json
Request message body:
{
name:取样人员,
desc:吴三桂
}
Response status:200
Response message header:
Content-type: application/json
Response message body:
{
role:{
name:'zhangsan',
uid:001,
initCaptial:'zhangsan1',
desc:’’
}
}
(2)delete
描述:从系统删除某个角色
Request message header:
Accept: application/json
Content-Type: application/json
Response status:204
Response message header:
Content-type: application/json
4. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/menu/
(1)post
描述:新增某角色下面的菜单树节点
Request message header:
Accept: application/json
Content-Type: application/json
Request message body:
{
menus:[{uid:1},{uid:2}]
}
Response status:201
Response message header:
Content-type: application/json
Content-Location:http://www.jlerp.com/sys/sys001/role/001/menu
Cache-Control:no-cache
Pragma: no-cache
Response message body:
{
menutree:
[
{
id: 1,
text: '原料样品',
singleClickExpand: true,
expanded: true,
children: [{
id: 1.1,
text: '原料化验',
leaf: true
},
{
id: 1.2,
text: '原料审核',
leaf: true
},
{
id: 1.3,
text: '原料判定',
leaf: true
}
]
},{
id: 2,
text: '生产样品',
children: []
}
]
}
(2)get
描述: 获取某角色下面的菜单树
Request message header:
Accept: application/json
Cache-Control: max-age=300
Response status:200
Response message header:
Content-type: application/json
Cache-Control: max-age=300
Response message body:
{
menutree:
[
{
id: 1,
text: '原料样品',
singleClickExpand: true,
expanded: true,
children: [{
id: 1.1,
text: '原料化验',
leaf: true
},
{
id: 1.2,
text: '原料审核',
leaf: true
},
{
id: 1.3,
text: '原料判定',
leaf: true
}
]
},{
id: 2,
text: '生产样品',
children: []
}
]
}
5. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/menu/{menuId:[\\w]{32}}/
(1)delete
描述:删除某个角色下面的某个菜单节点
Request message header:
Accept: application/json
Content-Type: application/json
Response status:204
Response message header:
Content-type: application/json
6. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/menu/deletebatch/
(1)post
描述:批量删除某个角色下面的菜单节点
Request message header:
Accept: application/json
Content-Type: application/json
Request message body:
{
menus: [{uid:1},{uid:2}]
}
Response status:204
Response message header:
Content-type: application/json
7. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/menu/exclude/
(1)get:
描述: 获取所选角色未拥有的菜单
Request message header:
Accept: application/json
Cache-Control: max-age=300
Response status:200
Response message header:
Content-type: application/json
Cache-Control: max-age=300
Response message body:
{
menutree:
[
{
id: 1,
text: '原料样品',
singleClickExpand: true,
expanded: true,
children: [{
id: 1.1,
text: '原料化验',
leaf: true
},
{
id: 1.2,
text: '原料审核',
leaf: true
},
{
id: 1.3,
text: '原料判定',
leaf: true
}
]
},{
id: 2,
text: '生产样品',
children: []
}
]
}
二、角色授权
1. URI:/sys/{sysCode}/role/
(1)get
描述:获取所有角色
Request message header:
Accept: application/json
Cache-Control: max-age=300
Response status:200
Response message header:
Content-type: application/json
Cache-Control: max-age=300
Response message body:
{
roles:
[
{name:zhangsan,uid:001,initCaptial: 'zhangsan',desc:’’},
{name:zhangsan2,uid:002,initCaptial: 'zhangsan2',desc:’’},
{name:zhangsan3,uid:003,initCaptial: 'zhangsan3',desc:’’}
]
}
2. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/post/
(2)post
描述:增加一个岗位到某个角色下
Request message header:
Accept: application/json
Content-Type: application/json
Request message body:
{postId:001}
Response status:201
Response message header:
Content-type: application/json
Content-Location:http://www.jlerp.com/sys/001/role/001/post/100
Cache-Control:no-cache
Pragma: no-cache
Response message body:
{
name:”软件工程师”:,
uid:001,
initCaptial:”000298”
org: “信息化部”
}
3. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/post/{postId:[\\w]{32}}/
(1)delete
描述:从某个角色删除某个岗位
Request message header:
Accept: application/json
Content-Type: application/json
Cache-Control: max-age=0
Response status:204
Response message header:
Content-type: application/json
Cache-Control:no-cache
Pragma: no-cache
4. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/post/deletebatch/
(1)post
描述:从某个角色批量删除岗位
Request message header:
Accept: application/json
Content-Type: application/json
Request message body:
{
posts:[
{postId:001},
{postId:002}
]
}
Response status:204
Response message header:
Content-type: application/json
5. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/user/
(2)post
描述:增加一个人员到某个角色
Request message header:
Accept: application/json
Content-Type: application/json
Request message body:
{ uid:001}
Response status:201
Response message header:
Content-type: application/json
Content-Location:http://www.jlerp.com/sys/001/role/001/user/100
Response message body:
{
person: code + ”(“ + name + ”)”,
name:”软件工程师”,
uid:001,
initCaptial:”000298”,
initName:”wxw”
}
6. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/user/{userId:[\\w]{32}}/
(1)delete
描述:从某个角色删除某个人员
Request message header:
Accept: application/json
Content-Type: application/json
Response status:204
Response message header:
Content-type: application/json
7. URI:/sys/{sysCode}/role/{roleId:[\\w]{32}}/user/deletebatch/
(1)post
描述:从某个角色批量删除人员
Request message header:
Accept: application/json
Content-Type: application/json
Request message body:
{
users:
[
{Uid:001},
{Uid:002}
]
}
Response status:204
Response message header:
Content-type: application/json
8. URI:/post-user/
(1)get
描述: 获取某角色下的所有岗位及所有人员
Request message header:
Accept: application/json
Cache-Control: max-age=300
Response status:200
Response message header:
Content-type: application/json
Cache-Control: max-age=300
Response message body:
{
users:
[
{
person: code + ”(“ + name + ”)”,
uid:001,
initCaptial:”000298”,
initName:”wxw”
},
{
person: code + ”(“ + name + ”)”,
uid:001,
initCaptial:”000293”,
initName:”wxz”
}
],
posts
[
{name:软件工程师1,uid:001,initCaptial: 'rjgcs',org: '信息化部'},
{name:软件工程师2,uid:001,initCaptial: 'rjgcs',org: '信息化部'},
{name:软件工程师3,uid:001,initCaptial: 'rjgcs',org: '信息化部'}
]
}
9. URI:/post/
(1)get
描述: 获取所有岗位
Request message header:
Accept: application/json
Cache-Control: max-age=300
Response status:200
Response message header:
Content-type: application/json
Cache-Control: max-age=300
Response message body:
{
posts:
[
{
uid:001,
name:”软件工程师”,
initCaptial:”rjgcs”,
org:”信息化部”
},
{
uid:002,
name:”网络工程师”,
initCaptial:”wlgcs”,
org:”信息化部”
}
]
}
10. URI:/user/
(1)get
描述: 获取所有人员
Request message header:
Accept: application/json
Cache-Control: max-age=300
Response status:200
Response message header:
Content-type: application/json
Cache-Control: max-age=300
Response message body:
{
users:
[
{
person: code + ”(“ + name + ”)”,
uid:001,
initCaptial:”000298”,
initName:”wxw”
},
{
person: code + ”(“ + name + ”)”,
uid:001,
initCaptial:”000293”,
initName:”wxz”
}
]
三、资源授权
1. URI:/sys/
(1)get
描述:获取系统信息
Request message header:
Accept: application/json
Response status:200
Response message header:
Content-type: application/json
Response message body:
[
{
name: "质量系统",
uid:001,
code: "qa",
initCaptial: "zlxt"
},
{
name: "财务系统",
uid:001,
code: "qb",
initCaptial: "cwxt"
}
]
2. URI:/sys/{sysCode}/resource/
(1)get
描述:获取指定系统下的全部资源
Request message header:
Accept: application/json
Response status:200
Response message header:
Content-type: application/json
Response message body:
{
resource:
[
{
uid:0101,
resource:www.abc.com,
description:资源描述,
methods:post,get,put,delete
},
{
uid:0102,
resource:www.abc2.com,
description:资源描述2,
methods:"post,delete"
}
]
}
(2)post
描述:新增资源
Request message header:
Accept: application/json
Content-Type: application/json
Request message body:
{
resource:www.abc.com,
description:资源描述,
methods:"get,pots,put,delete"
}
Response status:201
Response message header:
Content-type: application/json
Content-Location:http://www.jlerp.com/sys/001/resource/001
Response message body:
{
uid:0102,
resource:www.abc.com,
description:资源描述,
methods:"get,pots,put,delete"
}
3. URI:/sys/{sysCode}/resource/{resourceId:[\\w]{32}}/
(1)put
描述:修改资源
Request message header:
Accept: application/json
Content-Type: application/json
Request message body:
{
resource:www.abc2.com,
description:资源描述2,
methods:"get,pots,put"
}
Response status:200
Response message header:
Content-type: application/json
Response message body:
{
uid:0102,
resource:www.abc2.com,
description:资源描述2,
methods:"get,post,put"
}
(2)delete
描述:删除单个资源
Response status:200
4. URI:/sys/{sysCode}/resource/deletebatch/
(1)post
描述:批量删除资源
Request message header:
Content-Type: application/json
Request message body:
{resource:[{uid:1},{uid:2}]}
Response status:204
四、系统授权
1. URI:/sys/
(1)get
描述:获取所有系统
参看:3.1.1
(2)post
描述:维护系统(新增,修改,删除)
Request message header:
Accept: application/json
Request message body:
{
system:[
{
Uid:”xx”,
Name:”xx”,
Code:””
},
{
Uid:”xx”,
Name:”xx”,
Code:””
}
]
}
Response status:200
Response message header:
Content-type: application/json
Response message body:
[
{
name: "质量系统",
uid: "1",
code: "qa",
description: “质量系统”,
initCaptial: "zlxt"
},
{
name: "财务系统",
uid: "2",
code: "qb",
description:”财务系统”,
initCaptial: "cwxt"
}
]
2. URI:/sys/{sysCode}/menu/
(1)post
描述:给系统增加一个菜单节点(功能)
Request message header:
Accept: application/json
Request message body:
{
menuItem:{
name:xxx,
isdirectory:0,
puid:003
}
menuResource:[
{
menuid:001,
resourceId:002,
method:”post,get,put,delete”,
ismain:0
},
{
menuid:001,
resourceId:002,
method:”post,get,put,delete”,
ismain:1
}
]
}
Response status:200
Response message header:
Content-type: application/json
Response message body:
{
uid:001,
name:”xxx”,
url:”yyy”
}
(2)get
描述:获取指定系统下的所有功能
Request message header:
Accept: application/json
Response status:200
Response message header:
Content-type: application/json
Response message body:
[{
id:’1’,
name:’质量系统’,
initCaptial:’zlxt’,
uiProvider:’col’,
singleClickExpand:true,
children:[
{
id:’2’,
name:’原料样品’,
initCaptial:’ylyp’,
uiProvider:’col’,
singleClickExpand:true,
children:[
{
id:’3’,
name:’原料化验’,
initCaptial:’ylhy’,
url:’http://qa.ejianlong.com’,
leaf:true,
uiProvider:’col’
},
{
id:’4’,
name:’原料审核’,
initCaptial:’ylsh’,
url:’http://qa.ejianlong.com’,
leaf:true,
uiProvider:’col’
},
{
id:’5’,
name:’原料判定’,
initCaptial:’ylpd’,
url:’http://qa.ejianlong.com’,
leaf:true,
uiProvider:’col’
}
]
},
{
id:’6’,
name:’生产样品’,
initCaptial:’scyp’,
singleClickExpand:true,
uiProvider:’col’,
children:[]
},
{
id:’7’,
name:’抽检样品’,
initCaptial:’cjyp’,
singleClickExpand:true,
uiProvider:’col’,
children:[]
},
{
id:’8’,
name:’ 角色授权’,
initCaptial:’jssq’,
singleClickExpand:true,
uiProvider:’col’,
children:[]
},
{
id:’9’,
name:’系统授权’,
initCaptial:’xtsq’,
singleClickExpand:true,
uiProvider:’col’,
children:[]
},
{
id:’10’,
name:’资源授权’,
initCaptial:’zysq’,
singleClickExpand:true,
uiProvider:’col’,
children:[]
}
]
}]
3. URI:/sys/{sysCode}/menu/deletebatch/
(1)post
描述:从系统中批量删除菜单节点
Request message header:
Accept: application/json
Request message body:
{
menuitem:[
{
uid:001
},
{
uid:002
}
]
}
Response status:200
4. URI:/sys/{sysCode}/menu/{menuId:[\\w]{32}}/
(1)get
描述:获取系统下某菜单节点的相关信息
Request message header:
Accept: application/json
Response status:200
Response message header:
Content-type: application/json
Response message body:
{
name: ”xxx”,
resources:[
{
post: true,
get: true,
put: true,
delete: true
},
{
url: ”yyy”,
post: true,
get: true,
put: true,
delete: true
}
]
}
(2)put
描述:修改系统下的菜单节点
Request message header:
Accept: application/json
Request message body:
{
menuItem:{
name:xxx
},
menuResource:[
{
menuid:001,
resourceId:002,
method:”post,get,put,delete”,
ismain:0
},
{
menuid:001,
resourceId:002,
method:”post,get,put,delete”,
ismain:1
}
]
}
Response status:200
Response message header:
Content-type: application/json
Response message body:
{
uid:001,
name:”xxx”,
url:”yyy”
}
5. URI:/sys/{sysCode}/resource/
(1)get
描述:获取所有资源
参看:3.2.1