diff --git a/controller/service/config/categories.json b/controller/service/config/categories.json index 6893708..6ffa2dc 100644 --- a/controller/service/config/categories.json +++ b/controller/service/config/categories.json @@ -3,7 +3,7 @@ { "id": 1, "name": "Adult Content", - "risk_level": 5, + "trust_level": 1, "description": "Pornography and adult entertainment", "mappings": { "kaspersky": ["CATEGORY_PORNO_AND_EROTICS"] @@ -12,7 +12,7 @@ { "id": 2, "name": "Gambling", - "risk_level": 4, + "trust_level": 1, "description": "Online casinos, betting, lotteries", "mappings": { "kaspersky": ["CATEGORY_LOTTERIES", "CATEGORY_BETTING"] @@ -21,7 +21,7 @@ { "id": 3, "name": "Drugs", - "risk_level": 5, + "trust_level": 1, "description": "Illegal substances", "mappings": { "kaspersky": ["CATEGORY_DRUGS"] @@ -30,7 +30,7 @@ { "id": 4, "name": "Violence", - "risk_level": 5, + "trust_level": 5, "description": "Violent content", "mappings": { "kaspersky": ["CATEGORY_VIOLENCE"] @@ -39,7 +39,7 @@ { "id": 5, "name": "Weapons", - "risk_level": 5, + "trust_level": 1, "description": "Firearms, explosives", "mappings": { "kaspersky": ["CATEGORY_WEAPONS"] @@ -48,7 +48,7 @@ { "id": 6, "name": "Malware", - "risk_level": 5, + "trust_level": 1, "description": "Viruses and malicious software", "mappings": { "kaspersky": ["CATEGORY_MALWARE"] @@ -57,7 +57,7 @@ { "id": 7, "name": "Social media", - "risk_level": 2, + "trust_level": 4, "description": "Social media", "mappings": { "kaspersky": ["CATEGORY_INTERNET_COMMUNICATION_MEDIA", "CATEGORY_SOCIAL_NETS"] @@ -66,7 +66,7 @@ { "id": 8, "name": "Hate Speech", - "risk_level": 5, + "trust_level": 3, "description": "Discrimination, extremism", "mappings": { "kaspersky": ["CATEGORY_EXTREMISM_RACISM", "CATEGORY_HATE_AND_DISCRIMINATION"] @@ -75,7 +75,7 @@ { "id": 9, "name": "Anonymizers", - "risk_level": 4, + "trust_level": 2, "description": "VPN, proxies to bypass blocks", "mappings": { "kaspersky": ["CATEGORY_ANONYMIZERS"] @@ -84,7 +84,7 @@ { "id": 10, "name": "Alcohol and Tobacco", - "risk_level": 3, + "trust_level": 3, "description": "Sale of alcohol and tobacco", "mappings": { "kaspersky": ["CATEGORY_ALCOHOL"] @@ -93,11 +93,11 @@ { "id": 11, "name": "Online shop", - "risk_level": 1, + "trust_level": 5, "description": "Online shop", "mappings": { "kaspersky": ["CATEGORY_ONLINE_SHOPS"] } } ] -} \ No newline at end of file +} diff --git a/controller/service/internal/service/service.go b/controller/service/internal/service/service.go index c5d1921..e48d93a 100644 --- a/controller/service/internal/service/service.go +++ b/controller/service/internal/service/service.go @@ -125,3 +125,12 @@ func (s *Service) hasIntersection(a, b []string) bool { } return false } + +func (s *Service) GetCategory(id int) (string, int) { + for _, category := range s.categories.Categories { + if category.ID == id { + return category.Name, category.TrustLevel + } + } + return "", 0 +}