/** * Purpose: request supports permission.js by holding or executing the request page or API role. * Usage: import, call, read, or update this const from the owning page/module while preserving the surrounding loading and permission flow. */ const request = require('../utils/request') module.exports = { /** * Purpose: getCurrentUserPermissions supports permission.js by holding or executing the get current user permissions page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ getCurrentUserPermissions() { return request({ url: '/permission/user/current' }) }, /** * Purpose: getUserPermissions supports permission.js by holding or executing the get user permissions page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ getUserPermissions(userId) { return request({ url: `/permission/user/${userId}` }) }, /** * Purpose: getAssignablePermissionIds supports permission.js by holding or executing the get assignable permission ids page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ getAssignablePermissionIds(userId) { return request({ url: `/permission/assignable/${userId}` }) }, /** * Purpose: listAllPermissions supports permission.js by holding or executing the list all permissions page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ listAllPermissions() { return request({ url: '/permission/list/all' }) }, /** * Purpose: createPermission supports permission.js by holding or executing the create permission page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ createPermission(data) { return request({ url: '/permission/create', method: 'POST', data }) }, /** * Purpose: updatePermission supports permission.js by holding or executing the update permission page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ updatePermission(id, data) { return request({ url: `/permission/update/${id}`, method: 'PUT', data }) }, /** * Purpose: deletePermission supports permission.js by holding or executing the delete permission page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ deletePermission(id) { return request({ url: `/permission/delete/${id}`, method: 'DELETE' }) }, /** * Purpose: assignUserPermissions supports permission.js by holding or executing the assign user permissions page or API role. * Usage: import, call, read, or update this method from the owning page/module while preserving the surrounding loading and permission flow. */ assignUserPermissions(userId, permissionIds) { return request({ url: `/permission/assign/${userId}`, method: 'POST', data: { permissionIds } }) } }