C
C#3y ago
Alerin

Access list when creating an account

I'm creating a login system, I need an access list in it. Who can I allow to log in and who can I refuse. My model:
[Display(Name = "Access List", Description = "Access or deny list. Ability to set name, e-mail address, telephone, IPv4 or IPv6")]
public class AccessList
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public DataType Type { get; set; }
public AccessType Access { get; set; } = AccessType.Denied;
public StatusType Status { get; set; } = StatusType.Active;

public enum DataType
{
None,
Name, // User name
Mail, // Adress Mail
Phone, // Phone number
Domain, // Mail domain
IPv4, // Adres IP v4
IPv6, // Adres IP v6
}

public enum AccessType
{
Denied, // Black list
Access // White list
}

public enum StatusType
{
Inactive,
Active
}

}
[Display(Name = "Access List", Description = "Access or deny list. Ability to set name, e-mail address, telephone, IPv4 or IPv6")]
public class AccessList
{
public int Id { get; set; }
public string Name { get; set; } = string.Empty;
public string? Description { get; set; }
public DataType Type { get; set; }
public AccessType Access { get; set; } = AccessType.Denied;
public StatusType Status { get; set; } = StatusType.Active;

public enum DataType
{
None,
Name, // User name
Mail, // Adress Mail
Phone, // Phone number
Domain, // Mail domain
IPv4, // Adres IP v4
IPv6, // Adres IP v6
}

public enum AccessType
{
Denied, // Black list
Access // White list
}

public enum StatusType
{
Inactive,
Active
}

}
If the data in the database is a regular string, there is no problem finding it. The problem starts when I want to do a regex. For example: we have a username, we can do e.g. fuck, fuuck or some variation of it. (I'm not strong in English). It would be nice to do it with regex, now the question is how to search for such data in the database? Also, won't the regex become very slow at some point? The plus is that we search short phrases (max 320 characters).
4 Replies
james441
james4413y ago
Your question is not clear, what are your trying to do with regex?
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Alerin
AlerinOP3y ago
It doesn't have to be a database, I wonder if there is any other way than foreach and try every possibility.
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server