medha-one-access 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- medha_one_access-0.3.0/CHANGELOG.md +170 -0
- medha_one_access-0.3.0/LICENSE +21 -0
- medha_one_access-0.3.0/MANIFEST.in +46 -0
- medha_one_access-0.3.0/PKG-INFO +1124 -0
- medha_one_access-0.3.0/README.md +1058 -0
- medha_one_access-0.3.0/docs/DOCUMENTATION.md +2152 -0
- medha_one_access-0.3.0/docs/LIBRARY_API_REFERENCE.md +717 -0
- medha_one_access-0.3.0/docs/configuration.md +333 -0
- medha_one_access-0.3.0/docs/security.md +414 -0
- medha_one_access-0.3.0/docs/troubleshooting.md +507 -0
- medha_one_access-0.3.0/examples/README.md +131 -0
- medha_one_access-0.3.0/examples/__init__.py +5 -0
- medha_one_access-0.3.0/examples/advanced_patterns.py +328 -0
- medha_one_access-0.3.0/examples/application_filtering_example.py +225 -0
- medha_one_access-0.3.0/examples/basic_usage.py +188 -0
- medha_one_access-0.3.0/examples/cli_usage.py +195 -0
- medha_one_access-0.3.0/examples/custom_config.py +424 -0
- medha_one_access-0.3.0/examples/fastapi_integration.py +87 -0
- medha_one_access-0.3.0/examples/fastapi_mount_example.py +126 -0
- medha_one_access-0.3.0/medha_one_access/__init__.py +118 -0
- medha_one_access-0.3.0/medha_one_access/api/__init__.py +74 -0
- medha_one_access-0.3.0/medha_one_access/api/app.py +136 -0
- medha_one_access-0.3.0/medha_one_access/api/dependencies.py +88 -0
- medha_one_access-0.3.0/medha_one_access/api/mount.py +401 -0
- medha_one_access-0.3.0/medha_one_access/api/routers/__init__.py +25 -0
- medha_one_access-0.3.0/medha_one_access/api/routers/access_check.py +225 -0
- medha_one_access-0.3.0/medha_one_access/api/routers/access_rules.py +110 -0
- medha_one_access-0.3.0/medha_one_access/api/routers/access_summary.py +357 -0
- medha_one_access-0.3.0/medha_one_access/api/routers/artifacts.py +105 -0
- medha_one_access-0.3.0/medha_one_access/api/routers/data_io.py +621 -0
- medha_one_access-0.3.0/medha_one_access/api/routers/expressions.py +37 -0
- medha_one_access-0.3.0/medha_one_access/api/routers/reporting.py +422 -0
- medha_one_access-0.3.0/medha_one_access/api/routers/resourcegroups.py +47 -0
- medha_one_access-0.3.0/medha_one_access/api/routers/usergroups.py +47 -0
- medha_one_access-0.3.0/medha_one_access/api/routers/users.py +98 -0
- medha_one_access-0.3.0/medha_one_access/cli/__init__.py +21 -0
- medha_one_access-0.3.0/medha_one_access/cli/__main__.py +10 -0
- medha_one_access-0.3.0/medha_one_access/cli/main.py +401 -0
- medha_one_access-0.3.0/medha_one_access/core/__init__.py +30 -0
- medha_one_access-0.3.0/medha_one_access/core/background_tasks.py +559 -0
- medha_one_access-0.3.0/medha_one_access/core/base.py +9 -0
- medha_one_access-0.3.0/medha_one_access/core/cache.py +473 -0
- medha_one_access-0.3.0/medha_one_access/core/compatibility.py +218 -0
- medha_one_access-0.3.0/medha_one_access/core/config.py +646 -0
- medha_one_access-0.3.0/medha_one_access/core/constraints.py +288 -0
- medha_one_access-0.3.0/medha_one_access/core/controller.py +3343 -0
- medha_one_access-0.3.0/medha_one_access/core/database.py +560 -0
- medha_one_access-0.3.0/medha_one_access/core/exceptions.py +145 -0
- medha_one_access-0.3.0/medha_one_access/core/expressions.py +713 -0
- medha_one_access-0.3.0/medha_one_access/core/models.py +201 -0
- medha_one_access-0.3.0/medha_one_access/core/resolver.py +2088 -0
- medha_one_access-0.3.0/medha_one_access/core/schemas.py +598 -0
- medha_one_access-0.3.0/medha_one_access/migrations/alembic.ini +110 -0
- medha_one_access-0.3.0/medha_one_access/migrations/env.py +100 -0
- medha_one_access-0.3.0/medha_one_access/migrations/script.py.mako +27 -0
- medha_one_access-0.3.0/medha_one_access/migrations/versions/001_initial_schema.py +146 -0
- medha_one_access-0.3.0/medha_one_access/migrations/versions/002_add_application_to_access_summaries.py +70 -0
- medha_one_access-0.3.0/medha_one_access/py.typed +0 -0
- medha_one_access-0.3.0/medha_one_access.egg-info/SOURCES.txt +98 -0
- medha_one_access-0.3.0/pyproject.toml +173 -0
- medha_one_access-0.3.0/setup.cfg +4 -0
- medha_one_access-0.3.0/setup.py +108 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.3.0] - 2025-12-16
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Fully Configurable Library**: Expanded `LibraryConfig` with 40+ configurable parameters
|
|
12
|
+
- **Custom Environment Prefix**: Configure `env_prefix` to use any prefix for environment variables (default: `MEDHA_`)
|
|
13
|
+
- **Custom API Prefix**: Configure `api_prefix` to mount routes under any path (default: `/access`)
|
|
14
|
+
- **YAML/JSON Configuration**: Load configuration from YAML or JSON files using `LibraryConfig.from_file()`
|
|
15
|
+
- **Combined Configuration**: Use `LibraryConfig.from_env_or_file()` to load from file with environment overrides
|
|
16
|
+
- **Configurable Cache Settings**: Full control over cache sizes and TTLs for global, expression, and user access caches
|
|
17
|
+
- **Configurable Background Tasks**: Control worker count, queue size, timeouts, and cleanup settings
|
|
18
|
+
- **Configurable Database Pool**: Set pool size, overflow, recycle time, pre-ping, JIT, and timeouts
|
|
19
|
+
- **CacheManager**: New centralized cache management with `configure_caches()` function
|
|
20
|
+
- **Security Documentation**: Added `SECURITY.md` and `docs/security.md` with best practices
|
|
21
|
+
- **Troubleshooting Guide**: Added `docs/troubleshooting.md` for common issues
|
|
22
|
+
- **Configuration Reference**: Added `docs/configuration.md` with all parameters documented
|
|
23
|
+
- **Custom Config Examples**: New `examples/custom_config.py` with 8 configuration scenarios
|
|
24
|
+
- **Sample YAML Config**: Added `examples/config.example.yaml` template
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
- **Controller Initialization**: Both `AccessController` and `AsyncAccessController` now use `from_config()` methods for components
|
|
28
|
+
- **Database Manager**: Uses config for all pool settings via `AsyncDatabaseManager.from_config()`
|
|
29
|
+
- **Task Manager**: Uses config for all worker settings via `AsyncBackgroundTaskManager.from_config()`
|
|
30
|
+
- **Cache System**: All caches now initialized via `configure_caches(config)`
|
|
31
|
+
- **Documentation**: Reorganized and sanitized all documentation for public use
|
|
32
|
+
- **README**: Updated with configuration section and improved examples
|
|
33
|
+
|
|
34
|
+
### Removed
|
|
35
|
+
- Internal documentation files (`EXECUTE_SETUP.md`, `GIT_SETUP_GUIDE.md`, `INSTALLATION_TESTS.md`, `PUBLISH.md`, `ANALYSIS.md`, `PROJECT_SUMMARY.md`)
|
|
36
|
+
- Internal/private Git repository installation instructions
|
|
37
|
+
- Hardcoded configuration values throughout the codebase
|
|
38
|
+
|
|
39
|
+
### Technical Details
|
|
40
|
+
- All hardcoded values in `cache.py` replaced with config parameters
|
|
41
|
+
- All hardcoded values in `background_tasks.py` replaced with config parameters
|
|
42
|
+
- All hardcoded values in `database.py` replaced with config parameters
|
|
43
|
+
- Controller properly wires config to all components on initialization
|
|
44
|
+
- Backward compatible - existing code using defaults continues to work
|
|
45
|
+
|
|
46
|
+
### Migration
|
|
47
|
+
- **No Breaking Changes**: All existing code continues to work with default values
|
|
48
|
+
- **Optional Upgrade**: Use new configuration parameters for customization
|
|
49
|
+
- **Environment Variables**: Existing `MEDHA_*` variables still work as default
|
|
50
|
+
- **New Feature**: Add `yaml` optional dependency for YAML config support: `pip install medha-one-access[yaml]`
|
|
51
|
+
|
|
52
|
+
## [0.2.2] - 2025-08-26
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
- **Expression Validation**: Added support for additional common characters in entity names:
|
|
56
|
+
- Colons `:` (e.g., `"Entity: Test"`)
|
|
57
|
+
- Commas `,` (e.g., `"Entity, Demo"`)
|
|
58
|
+
- Apostrophes `'` (e.g., `"FD's Snapshot"`)
|
|
59
|
+
- **Character Validation**: Updated allowed character set for comprehensive entity name support
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
- **Validation Regex**: Enhanced pattern to: `r"[^a-zA-Z0-9_+\-|.\s@&#\"():,']"`
|
|
63
|
+
- **Error Messages**: Updated to include colons, commas, and apostrophes in allowed characters list
|
|
64
|
+
|
|
65
|
+
## [0.2.1] - 2025-08-26
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
- **Expression Validation**: Added support for parentheses `()` in entity names (e.g., `"Manpower Budget (Input to Finance) FY26"`)
|
|
69
|
+
- **Character Validation**: Updated allowed character set to include parentheses for entity names with brackets
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
- **Validation Regex**: Updated validation pattern to allow parentheses: `r'[^a-zA-Z0-9_+\-|.\s@&#"()]'`
|
|
73
|
+
- **Error Messages**: Updated validation error messages to include parentheses in allowed characters list
|
|
74
|
+
|
|
75
|
+
## [0.2.0] - 2025-08-26
|
|
76
|
+
|
|
77
|
+
### Added
|
|
78
|
+
- **Quoted Entity Support**: Added support for quoted entities in expressions to handle entity names with hyphens and special characters
|
|
79
|
+
- **Enhanced Expression Validation**: Added validation for properly matched quotes in expressions
|
|
80
|
+
|
|
81
|
+
### Fixed
|
|
82
|
+
- **Critical Expression Parsing Bug**: Fixed major bug where entity IDs containing hyphens (e.g., `user-service-api`) were incorrectly parsed as mathematical operations
|
|
83
|
+
- **Expression Validation**: Updated validation to allow quotes in expressions while maintaining security
|
|
84
|
+
|
|
85
|
+
### Changed
|
|
86
|
+
- **Expression Parser**: Updated core expression parsing regex to support quoted entities: `"entity-with-hyphens"`
|
|
87
|
+
- **Backward Compatibility**: Maintained 100% compatibility with existing unquoted expressions
|
|
88
|
+
|
|
89
|
+
### Technical Details
|
|
90
|
+
- Updated `ExpressionParser.parse_expression()` regex pattern to: `r'([+-]?)(".*?"|[^+-]+)'`
|
|
91
|
+
- Added automatic quote stripping in token processing
|
|
92
|
+
- Enhanced `validate_expression()` to check for unmatched quotes
|
|
93
|
+
- Updated allowed character validation to include quote characters
|
|
94
|
+
|
|
95
|
+
### Migration
|
|
96
|
+
- **No Breaking Changes**: All existing expressions continue to work unchanged
|
|
97
|
+
- **New Feature**: Entities with special characters can now be quoted for proper parsing
|
|
98
|
+
- **Examples**:
|
|
99
|
+
- Old (broken): `user-service-api+admin-panel`
|
|
100
|
+
- New (working): `"user-service-api"+"admin-panel"`
|
|
101
|
+
- Still works: `simpleuser+basicgroup`
|
|
102
|
+
|
|
103
|
+
## [0.1.1] - 2025-08-25
|
|
104
|
+
|
|
105
|
+
### Fixed
|
|
106
|
+
- **Pagination Defaults**: Fixed hardcoded 100-record limits in all list methods (list_users, list_artifacts, list_access_rules)
|
|
107
|
+
- **User Group Resolution**: Fixed `get_usergroup_members` method to use correct `resolve_user_expression` method instead of non-existent `resolve_expression`
|
|
108
|
+
- **Query Optimization**: Updated all list methods to support optional limit parameter for unlimited record loading
|
|
109
|
+
|
|
110
|
+
### Changed
|
|
111
|
+
- **list_users()**: Changed limit parameter from `int = 100` to `Optional[int] = None`
|
|
112
|
+
- **list_artifacts()**: Changed limit parameter from `int = 100` to `Optional[int] = None`
|
|
113
|
+
- **list_access_rules()**: Changed limit parameter from `int = 100` to `Optional[int] = None`
|
|
114
|
+
- **Query Logic**: Added conditional query execution to apply limit only when specified
|
|
115
|
+
|
|
116
|
+
## [0.1.0] - 2025-08-19
|
|
117
|
+
|
|
118
|
+
### Added
|
|
119
|
+
- Initial release of Access Control Library
|
|
120
|
+
- BODMAS-based access resolution engine with 4-step priority system
|
|
121
|
+
- Expression-based user and resource grouping with + (include) and - (exclude) operators
|
|
122
|
+
- Time-based access constraints (date ranges, time windows, day-of-week restrictions)
|
|
123
|
+
- Comprehensive audit trails for access decisions
|
|
124
|
+
- SQLAlchemy models and Pydantic schemas for all entities
|
|
125
|
+
- Database management with Alembic migrations
|
|
126
|
+
- AccessController class providing clean Python API
|
|
127
|
+
- CLI tools for database management, data import/export, and access checking
|
|
128
|
+
- FastAPI integration module for optional web APIs
|
|
129
|
+
- Complete test suite with fixtures and examples
|
|
130
|
+
- Type hints and py.typed marker for full typing support
|
|
131
|
+
- Support for PostgreSQL and SQLite databases
|
|
132
|
+
- Hierarchical organization structures
|
|
133
|
+
- Context managers for database sessions
|
|
134
|
+
- Expression validation and error handling
|
|
135
|
+
|
|
136
|
+
### Supported Features
|
|
137
|
+
- **User Management**: Create individual users and user groups with expressions
|
|
138
|
+
- **Resource Management**: Create individual resources and resource groups with expressions
|
|
139
|
+
- **Access Rules**: Define flexible access rules with user/resource expressions and permissions
|
|
140
|
+
- **Time Constraints**: Apply temporal restrictions to access rules
|
|
141
|
+
- **BODMAS Resolution**: Mathematical precedence-based access resolution
|
|
142
|
+
- **Audit Trails**: Detailed logging of access resolution steps
|
|
143
|
+
- **CLI Interface**: Command-line tools for all operations
|
|
144
|
+
- **REST API**: Optional FastAPI integration for web services
|
|
145
|
+
- **Database Support**: PostgreSQL (recommended) and SQLite
|
|
146
|
+
- **Migration Support**: Alembic-based database schema management
|
|
147
|
+
|
|
148
|
+
### Technical Specifications
|
|
149
|
+
- Python 3.8+ support
|
|
150
|
+
- SQLAlchemy 2.0+ with async support
|
|
151
|
+
- Pydantic v2 for data validation
|
|
152
|
+
- FastAPI for optional web API
|
|
153
|
+
- Click for CLI interface
|
|
154
|
+
- Comprehensive test coverage
|
|
155
|
+
- Type hints throughout
|
|
156
|
+
- Modern Python packaging (pyproject.toml)
|
|
157
|
+
|
|
158
|
+
## [Unreleased]
|
|
159
|
+
|
|
160
|
+
### Planned Features
|
|
161
|
+
- Redis caching for improved performance
|
|
162
|
+
- Webhook notifications for access events
|
|
163
|
+
- LDAP/Active Directory integration
|
|
164
|
+
- Role-based access control (RBAC) helpers
|
|
165
|
+
- Attribute-based access control (ABAC) extensions
|
|
166
|
+
- GraphQL API support
|
|
167
|
+
- Performance optimizations and query optimization
|
|
168
|
+
- Additional database backend support (MySQL, MongoDB)
|
|
169
|
+
- Docker containerization
|
|
170
|
+
- Kubernetes deployment examples
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Medha Analytics
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Include important files in package distribution
|
|
2
|
+
include README.md
|
|
3
|
+
include LICENSE
|
|
4
|
+
include CHANGELOG.md
|
|
5
|
+
include pyproject.toml
|
|
6
|
+
include setup.py
|
|
7
|
+
|
|
8
|
+
# Include package data
|
|
9
|
+
recursive-include medha_one_access/migrations *.py *.ini *.mako
|
|
10
|
+
recursive-include medha_one_access *.py
|
|
11
|
+
|
|
12
|
+
# Include documentation
|
|
13
|
+
recursive-include docs *.rst *.py *.bat *.md
|
|
14
|
+
recursive-include docs/_static *
|
|
15
|
+
recursive-include docs/_templates *
|
|
16
|
+
|
|
17
|
+
# Include examples
|
|
18
|
+
recursive-include examples *.py *.md *.txt *.json
|
|
19
|
+
|
|
20
|
+
# Include tests (optional - usually excluded from wheel)
|
|
21
|
+
recursive-include tests *.py *.json *.txt
|
|
22
|
+
|
|
23
|
+
# Exclude development and build files
|
|
24
|
+
exclude .gitignore
|
|
25
|
+
exclude .pre-commit-config.yaml
|
|
26
|
+
exclude tox.ini
|
|
27
|
+
exclude .coverage
|
|
28
|
+
exclude pytest.ini
|
|
29
|
+
|
|
30
|
+
# Exclude build artifacts
|
|
31
|
+
prune build
|
|
32
|
+
prune dist
|
|
33
|
+
prune *.egg-info
|
|
34
|
+
prune .git
|
|
35
|
+
prune .github
|
|
36
|
+
prune __pycache__
|
|
37
|
+
prune .pytest_cache
|
|
38
|
+
prune .mypy_cache
|
|
39
|
+
prune .tox
|
|
40
|
+
|
|
41
|
+
# Exclude editor files
|
|
42
|
+
global-exclude *.pyc
|
|
43
|
+
global-exclude *.pyo
|
|
44
|
+
global-exclude *.swp
|
|
45
|
+
global-exclude *~
|
|
46
|
+
global-exclude .DS_Store
|