1

I'm using ServiceStack and I dont know if my way is true or not for this requirement with ServiceStack Permission support.

Now rule table structure is:

  • TargetRole
  • TargetUserId
  • DENY/ALLOW
  • ActionTypeEnum
  • StartDate
  • EndDate
  • StartHour
  • EndHour

  • RunningEnum ([Flags] OnlyOnce=1,Monday=2,....,Sunday=128)

Rule: All admins could not (DENY) crateUser (ACTIONTYPEENUM.CREATEUSER) every Mondays (RUNNINGENUM=2) between 12-17 hours (STARTHOUR=12,ENDHOUR=17)

So I have to solve these rules (and if I can I have to bind with ServiceStack Permission), Is there any problem on my way or any better framework or ruleresolver in C# ?

Oguz Karadenizli
  • 3,449
  • 6
  • 38
  • 73

2 Answers2

1

ServiceStack's RequireRole and RequiredPermissions attributes let you mark what Roles / Permission a service needs. The implementation of RequireRole just calls IAuthSession.HasRole() (or IAuthSession.HasPermission()) which determines whether the user has the role specified.

When you register your own CustomUserSession you can implement the above methods to do exactly what you need.

The alternative is to ignore the existing Roles/Permissions support and just create your own Request Filter Attribute and have it execute before each request you want validated.

mythz
  • 141,670
  • 29
  • 246
  • 390
0

There is no framework for ACL implemantation in C#. You have to write your own! So do I :)

Oguz Karadenizli
  • 3,449
  • 6
  • 38
  • 73