public interface IPermissionService { bool HasAccess(string userId, string permissionName); }
public interface IPermissionService { bool IsAuthorized(string userId, string[] roles, string[] permissions); }This example checks whether the given user is authorized to access a particular resource. The method takes three parameters, the user ID, an array of roles, and an array of permissions. It returns a boolean value indicating whether the user is authorized. The IPermissionService interface is often included in package libraries that provide security and authorization features for C# applications, such as the ASP.NET Identity package or the IdentityServer4 package.