Closed obervinov closed 9 months ago
done https://github.com/obervinov/users-package/pull/24/commits/49119230afd84a13695c3d1297ce8d72c63cefc3 https://github.com/obervinov/users-package/pull/24/commits/ee18c20752d915e21938c5c6be5329861081dac3 https://github.com/obervinov/users-package/pull/24/commits/48966d496ff0b017b1790f191f3f7d18609aedab https://github.com/obervinov/users-package/pull/24/commits/0b2a79d00f3b63dce0fb03e6f89752ea3fa95ef6 https://github.com/obervinov/users-package/pull/24/commits/ec24cd1e58fd6e2b996997a3e621d700341fb070 https://github.com/obervinov/users-package/pull/24/commits/1cf6d6737c8dd96ffe49047005c7601a267ee14f https://github.com/obervinov/users-package/pull/24/commits/8d0a568b18e83254b645759d236ccd6e0b50ac88 https://github.com/obervinov/users-package/pull/24/commits/dd5163a7aca4fd72d4a97c8f4f753aa9cd842bc1
Context For more flexible management of telegram bot users and their rights to the bot, it is necessary to expand user attributes, add additional methods for working with these attributes and rewrite existing class methods for a new model.
Data structure requirements
Requirements
the end time
, if not applied,none
user_id
androle_name
as input: returnallowed
if user_id contains role_name anddenied
if notauthentication()
,authorization()
,rl_controller()
- aggregate the responses of these methods into a single dictionary and give in the responseauthorization
of the role and user was successful, write +1 request to the request counterData structure in vault For configuration:
configuration/users/{user_id}:status
->authentication()
configuration/users/{user_id}:roles
->authorization()
configuration/users/{user_id}:requests
->rl_controller()
For dynamic data:
data/users/{user_id}:requests_counters
->rl_controller()
data/users/{user_id}:rate_limits
->rl_controller()
data/users/{user_id}:authorization
->authorization()
data/users/{user_id}:authentication
->authentication()
New methods:
user_access_check()
- an entry point that aggregates function calls and responses for unification and ease of use in bots.authentication()
- method for checking user access rights to the botauthorization()
- method for checking access rights to a specific bot functionality (assigning roles)rl_controller()
- method for implementing request accounting and request rate limiting in the context of usersDocumentation: