File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,11 @@ namespace OneBus.API.Authorizations
44{
55 public class FeatureRequirement : IAuthorizationRequirement
66 {
7- public FeatureRequirement ( string featureCode )
7+ public FeatureRequirement ( byte featureCode )
88 {
99 FeatureCode = featureCode ;
1010 }
1111
12- public string FeatureCode { get ; }
12+ public byte FeatureCode { get ; }
1313 }
1414}
Original file line number Diff line number Diff line change 55using OneBus . Domain . Constants ;
66using Microsoft . OpenApi . Models ;
77using OneBus . API . Authorizations ;
8+ using OneBus . Application . Services ;
89using OneBus . Infra . Data . DbContexts ;
910using Microsoft . EntityFrameworkCore ;
1011using System . Text . Json . Serialization ;
1112using Microsoft . AspNetCore . Http . Json ;
1213using Microsoft . IdentityModel . Tokens ;
1314using Microsoft . AspNetCore . Authorization ;
15+ using OneBus . Application . Interfaces . Services ;
1416using Microsoft . AspNetCore . Authentication . JwtBearer ;
1517
1618var builder = WebApplication . CreateBuilder ( args ) ;
150152 . AddPolicy ( PolicyConstants . UpdateUser , policy =>
151153 policy . Requirements . Add ( new FeatureRequirement ( FeaturesCode . UpdateUserCode ) ) ) ;
152154
153- builder . Services . AddSingleton < IAuthorizationHandler , FeatureHandler > ( ) ;
155+ builder . Services . AddScoped < IUserTypeFeatureService , UserTypeFeatureService > ( ) ;
156+ builder . Services . AddScoped < IAuthorizationHandler , FeatureHandler > ( ) ;
154157
155158// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
156159builder . Services . AddEndpointsApiExplorer ( ) ;
You can’t perform that action at this time.
0 commit comments