Open guvalua opened 1 year ago
You can implement your own quote in 3 ways at least:
Implement your own plugin.
turms-service has an extension point im.turms.service.infra.plugin.extension.ClientRequestHandler
, you can get the requester ID and the recipient ID or group ID if it's a CreateMessageRequest
from its input param ClientRequest clientRequest
, and you can try to implement your own quota limiting plugin based on it.
I think this may be the best solution for your use cases.
Maintain your own repo.
If your use cases are complex, you can modify Turms source code for your use cases. Every Turms User
has a property permissionGroupId
, which is just like the role you mentioned, and every role has its own quota limiting stored in im.turms.service.domain.user.po.UserPermissionGroup
.
And you may implement your business logic based on it, but it's not recommended because if you modify the source code of Turms, you need to maintain your code and distribution yourself.
Wait for us to implement the solution ②. We may support message quota-limiting features in the future, and the solution will be similar to the solution ② as mentioned above. But we can just implement common use cases so that most users can benefit from it, you can not use it directly if your use cases are complex. And I am busy recently, so no effort for the solution currently. So you better not wait for me.
What is the best implementation to support limitation of creating message based on the user role or other conditions, for example one based on the role(VIP or not), can only send a limited number of message to another?
Implement a plugin which check the limitation via HttpClient connected to the business server , or some other ways?
Any advices?NEED HELP.