mirror of
https://gitee.com/ctexthuang/hyperf_rbac_framework_server_ctexthuang.git
synced 2025-12-25 17:07:49 +08:00
feat : admin role finish
This commit is contained in:
@@ -37,38 +37,56 @@ class AdminRoleController
|
||||
return $this->service->handle();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[RequestMapping(path: "", methods: "POST")]
|
||||
#[Permission(code: 'permission:role:save')]
|
||||
public function createRole()
|
||||
public function createRole(): array
|
||||
{
|
||||
return $this->service->create();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
#[RequestMapping(path: "{id}", methods: "PUT")]
|
||||
#[Permission(code: 'permission:role:update')]
|
||||
public function updateRole(int $id)
|
||||
public function updateRole(int $id): array
|
||||
{
|
||||
return $this->service->update($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
#[RequestMapping(path: "", methods: "DELETE")]
|
||||
#[Permission(code: 'permission:role:delete')]
|
||||
public function deleteRole()
|
||||
public function deleteRole(): array
|
||||
{
|
||||
return $this->service->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
#[RequestMapping(path: "{id}/permission", methods: "GET")]
|
||||
#[Permission(code: 'permission:role:getMenu')]
|
||||
public function getRolePermission()
|
||||
public function getRolePermission(int $id): array
|
||||
{
|
||||
return $this->service->getRole();
|
||||
return $this->service->getRole($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return array
|
||||
*/
|
||||
#[RequestMapping(path: "{id}/permission", methods: "PUT")]
|
||||
#[Permission(code: 'permission:role:setMenu')]
|
||||
public function batchGrantPermissionByRole()
|
||||
public function batchGrantPermissionByRole(int $id): array
|
||||
{
|
||||
return $this->service->setRole();
|
||||
return $this->service->setRole($id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user