abpframework / abp

Open Source Web Application Framework for ASP.NET Core. Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET and the ASP.NET Core platforms. Provides the fundamental infrastructure, production-ready startup templates, application modules, UI themes, tooling, guides and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.27k stars 3.32k forks source link

Rewrite identityuser application service. #19592

Open 1957993455 opened 2 weeks ago

1957993455 commented 2 weeks ago

Is there an existing issue for this?

Description

我在application层使用来替换identityuser时,swgger的接口并没有替换原始的接口,这个问题如何解决?

[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IIdentityUserAppService), typeof(IdentityUserAppService)
    , typeof(MyUserAppService))]
public class MyUserAppService: IdentityUserAppService
{
    public MyUserAppService(IdentityUserManager userManager, 
        IIdentityUserRepository userRepository, 
        IIdentityRoleRepository roleRepository,
        IOptions<IdentityOptions> identityOptions, 
        IPermissionChecker permissionChecker) : 
        base(userManager, userRepository, roleRepository,
            identityOptions, permissionChecker)
    {

    }
  [RemoteService(isEnabled:true)]
        public async Task<string> GetNameAA()
        {
            await Task.Delay(200);
            return "hello";
        }

}

在加上面代码之前swgger的断电列表为

GET
​/api​/identity​/users​/{id}

PUT
​/api​/identity​/users​/{id}

DELETE
​/api​/identity​/users​/{id}

GET
​/api​/identity​/users

POST
​/api​/identity​/users

GET
​/api​/identity​/users​/{id}​/roles

PUT
​/api​/identity​/users​/{id}​/roles

GET
​/api​/identity​/users​/assignable-roles

GET
​/api​/identity​/users​/by-username​/{userName}

GET
​/api​/identity​/users​/by-email​/{email}

加了之后端点为

GET
​/api​/identity​/users​/{id}

PUT
​/api​/identity​/users​/{id}

DELETE
​/api​/identity​/users​/{id}

GET
​/api​/identity​/users

POST
​/api​/identity​/users

GET
​/api​/identity​/users​/{id}​/roles

PUT
​/api​/identity​/users​/{id}​/roles

GET
​/api​/identity​/users​/assignable-roles

GET
​/api​/identity​/users​/by-username​/{userName}

GET
​/api​/identity​/users​/by-email​/{email}

GET
​/api​/app​/user​/entire-collection

GET
​/api​/app​/user​/{id}

PUT
​/api​/app​/user​/{id}

DELETE
​/api​/app​/user​/{id}

GET
​/api​/app​/user

POST
​/api​/app​/user

GET
​/api​/app​/user​/{id}​/roles

PUT
​/api​/app​/user​/{id}​/roles

GET
​/api​/app​/user​/assignable-roles

POST
​/api​/app​/user​/find-by-username

POST

我该如何解决这个问题呢?我尝试使用 [RemoteService(isEnabled:true)]来禁用,确实起到效果了,但是我想向userAppservice添加以下方法作为api时,不能在swgger显示

```
[RemoteService(isEnabled:true)]
    public async Task<string> GetNameAA()
    {
        await Task.Delay(200);
        return "hello";
    }

能帮我解决一下?

### Reproduction Steps

_No response_

### Expected behavior

_No response_

### Actual behavior

_No response_

### Regression?

_No response_

### Known Workarounds

_No response_

### Version

8.1

### User Interface

Common (Default)

### Database Provider

EF Core (Default)

### Tiered or separate authentication server

None (Default)

### Operation System

Windows (Default)

### Other information

_No response_
CY-Ye commented 1 week ago

按照你的需求来说,你应该重写IdentityUserController,而非IdentityUserAppService。因为Abp Identity并没有将IdentityUserAppService动态生成Controller,而是IdentityUserController调用了IdentityUserAppService而已