add: Added grpc api, perm system

add: grpc api config in creds
This commit is contained in:
Kwoth
2024-10-03 02:01:03 +00:00
parent a7be56a562
commit 5d76a15dc0
14 changed files with 413 additions and 49 deletions

View File

@@ -14,6 +14,7 @@ public class ExprsSvc : GrpcExprs.GrpcExprsBase, INService
_svc = svc;
}
[GrpcApiPerm(GuildPerm.Administrator)]
public override async Task<AddExprReply> AddExpr(AddExprRequest request, ServerCallContext context)
{
NadekoExpression expr;
@@ -44,6 +45,7 @@ public class ExprsSvc : GrpcExprs.GrpcExprsBase, INService
};
}
[GrpcApiPerm(GuildPerm.Administrator)]
public override async Task<GetExprsReply> GetExprs(GetExprsRequest request, ServerCallContext context)
{
var (exprs, totalCount) = await _svc.FindExpressionsAsync(request.GuildId, request.Query, request.Page);
@@ -64,6 +66,7 @@ public class ExprsSvc : GrpcExprs.GrpcExprsBase, INService
return reply;
}
[GrpcApiPerm(GuildPerm.Administrator)]
public override async Task<Empty> DeleteExpr(DeleteExprRequest request, ServerCallContext context)
{
await _svc.DeleteAsync(request.GuildId, new kwum(request.Id));