Skip to content

Commit

Permalink
Change user roles
Browse files Browse the repository at this point in the history
  • Loading branch information
perastov committed Mar 1, 2024
1 parent 18ecbd9 commit a49bc5d
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 74 deletions.
11 changes: 11 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Release History
===============

2.12.0a7 (2024-03-01)
---------------------
- Change user roles

2.12.0a6 (2024-02-02)
---------------------
- Mention changes in 2.11.1
Expand All @@ -25,6 +29,13 @@ Release History
---------------------
- Add Platforms attribute

2.11.2 (26.02.2024)
-------------------
- Add Dictionaries to ResourceNames
- Add DictionaryReader and DictionaryRegistrant roles.
- Remove privileges Feeds, FeedsData and SearchFilters from roles FeedAdministrator и FeedDataReader
- Remove privilege SearchFilters from role Searcher

2.11.1 (2024-02-02)
-------------------
- Export PotentialDamage and RIR attributes
Expand Down
2 changes: 1 addition & 1 deletion cybsi/api/user/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ class UserForm(JsonObjectForm):
>>> userForm = UserForm(
>>> login="user_test",
>>> access_level=ShareLevels.Green,
>>> roles=[RoleName.EntityReader],
>>> roles=[RoleName.SystemAdministrator],
>>> password="string",
>>> full_name="Test Tester",
>>> email="test@pt.com",
Expand Down
128 changes: 56 additions & 72 deletions cybsi/api/user/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,83 +12,61 @@ class RoleName(CybsiAPIEnum):
See :class:`ResourceName`.
"""

Administrator = "Administrator"
SystemAdministrator = "SystemAdministrator"
"""
Administrator's role permissions:
[DataSources:rw,EnrichmentConfig:r,Users:r]
"""
ConfigReader = "ConfigReader"
"""
ConfigReader's role permissions:
[DataSources:r, EnrichmentConfig:r]
"""
FeedAdministrator = "FeedAdministrator"
"""
FeedAdministrator's role permissions:
[DataSources:r, Feeds:rw, FeedsData:r, Observable:r,
ReputationLists:rw, ReputationListsContent:r, Search:r,
SearchFilters:rw, StoredQuery:rw, Users:r]
"""
FeedDataReader = "FeedDataReader"
"""
FeedDataReader's role permissions:
[DataSources:r, Feeds:r, FeedsData:r, ReputationLists:r,
ReputationListsContent:r, SearchFilters:r, StoredQuery:r, Users:r]
"""
EnrichmentRunner = "EnrichmentRunner"
"""
EnrichmentRunner's role permissions:
[DataSources:r, EnrichmentTasks:rw]
"""
EnrichmentTaskReader = "EnrichmentTaskReader"
"""
EnrichmentTaskReader's role permissions:
[DataSources:r, EnrichmentTasks:r]
"""
ReportRegistrant = "ReportRegistrant"
"""
ReportRegistrant's role permissions:
[Observations:w, Reports:w]
"""
ReportReader = "ReportReader"
"""
ReportReader's role permissions:
[DataSources:r, Observations:r, RawReports:r, Reports:r]
"""
EntityRegistrant = "EntityRegistrant"
"""
EntityRegistrant's role permissions:
[Observable:w]
"""
EntityReader = "EntityReader"
"""
EntityReader's role permissions:
[DataSources:r, Observable:r]
.. versionadded:: 2.12
System administrator's role permissions:
[DataSources:r,Users:rw,APIKeys:rw,License:w]
"""
ArtifactReader = "ArtifactReader"
DataEngineer = "DataEngineer"
"""
ArtifactReader's role permissions:
[Artifacts:r, DataSources:r]
.. versionadded:: 2.12
Data engineer's role permissions:
[StoredQuery:rw,Observable:r,EntityView:r,Artifacts:r,
ArtifactsContent:r,ReputationLists:rw,ReputationListsContent:r,
EnrichmentConfig:rw,DataSources:rw,Users:rw,APIKeys:rw,
Dictionaries:rw]
"""
ArtifactRegistrant = "ArtifactRegistrant"
SOCAnalyst = "SOCAnalyst"
"""
ArtifactRegistrant's role permissions:
[Artifacts:w]
.. versionadded:: 2.12
SOC analyst's role permissions:
[StoredQuery:rw,Observable:rw,EntityView:r,Artifacts:rw,
ArtifactsContent:r,Reports:rw,Observations:rw,RawReports:r
EnrichmentTasks:rw,ReputationLists:rw,ReputationListsContent:r,
EnrichmentConfig:r,DataSources:r,Users:r,Dictionaries:rw]
"""
ArtifactContentReader = "ArtifactContentReader"
CTIAnalyst = "CTIAnalyst"
"""
ArtifactContentReader's role permissions:
[Artifacts:r, ArtifactsContent:r]
.. versionadded:: 2.12
CTI analyst's role permissions:
[StoredQuery:r,Observable:rw,EntityView:r,Artifacts:rw,
ArtifactsContent:r,Reports:rw,Observations:rw,RawReports:r
EnrichmentTasks:rw,ReputationLists:r,ReputationListsContent:r,
EnrichmentConfig:r,DataSources:r,Users:r,Dictionaries:rw]
"""
Searcher = "Searcher"
CyberSecuritySpecialist = "CyberSecuritySpecialist"
"""
Searcher's role permissions:
[DataSources:r, Observable:r, Search:r, SearchFilters:rw]
.. versionadded:: 2.12
Cyber security specialist's role permissions:
[StoredQuery:r,Observable:r,EntityView:r,Artifacts:r,
Reports:r,Observations:r,RawReports:r,EnrichmentTasks:rw,
ReputationLists:r,ReputationListsContent:r,
EnrichmentConfig:r,DataSources:r,Users:r,Dictionaries:rw]
"""
UserAdministrator = "UserAdministrator"
Guest = "Guest"
"""
UserAdministrator's role permissions:
[APIKeys:rw, Users:rw]
.. versionadded:: 2.12
Guest's role permissions:
[Observable:r,Artifacts:r,Reports:r,Observations:r,
RawReports:r,EnrichmentTasks:r,EnrichmentConfig:r,
DataSources:r,Dictionaries:r]
"""


Expand All @@ -107,14 +85,16 @@ class ResourceName(CybsiAPIEnum):
"""Sample contents. Permission can be only with reading action."""
DataSources = "DataSources"
"""Data sources."""
Dictionaries = "Dictionaries"
"""
.. versionadded:: 2.11.2
Dictionaries
"""
EnrichmentConfig = "EnrichmentConfig"
"""Enrichment configs."""
EnrichmentTasks = "EnrichmentTasks"
"""Enrichment tasks."""
Feeds = "Feeds"
"""Feeds."""
FeedsData = "FeedsData"
"""Feed contents. Permission can be only with reading action."""
Observable = "Observable"
"""Observable entities."""
Observations = "Observations"
Expand All @@ -128,8 +108,6 @@ class ResourceName(CybsiAPIEnum):
"""Reports."""
Search = "Search"
"""Search. Permission can be only with reading action."""
SearchFilters = "SearchFilters"
"""Search filters."""
Users = "Users"
"""Users."""
APIKeys = "APIKeys"
Expand All @@ -140,3 +118,9 @@ class ResourceName(CybsiAPIEnum):
"""Reputation list contents. Permission can be only with reading action."""
StoredQuery = "StoredQuery"
"""Stored queries."""
License = "License"
"""
.. versionadded:: 2.12
Licenses.
"""
2 changes: 1 addition & 1 deletion examples/authentication/user_api_key_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
userForm = UserForm(
login="user_test",
access_level=ShareLevels.Green,
roles=[RoleName.EntityReader],
roles=[RoleName.SystemAdministrator],
password="string",
full_name="Test Tester",
email="test@pt.com",
Expand Down

0 comments on commit a49bc5d

Please sign in to comment.