Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access control #3

Merged
merged 8 commits into from
Aug 6, 2023
Merged

Access control #3

merged 8 commits into from
Aug 6, 2023

Conversation

ijwfly
Copy link
Owner

@ijwfly ijwfly commented Aug 6, 2023

The bot now includes a feature for access control. Each user is assigned a role (stranger, basic, advanced, admin), and depending on the role, they gain access to the bot. Role management is carried out through a messaging mechanism, with inline buttons sent to the admin for role changes.

Also added some new settings to settings.py:

# User access settings
# You can setup default role for new users and minimum role needed to access bot, see UserRole enum
USER_ROLE_DEFAULT = UserRole.BASIC  # default role assigned to new users
USER_ROLE_BOT_ACCESS = UserRole.BASIC  # minimum role needed to access bot
USER_ROLE_CHOOSE_MODEL = UserRole.BASIC  # minimum role needed to choose model (gpt-3.5/gpt-4)

# Enables chat for user role management
# When enabled sends new user info to USER_ROLE_MANAGER_CHAT_ID with keyboard to choose user role
ENABLE_USER_ROLE_MANAGER_CHAT = False
USER_ROLE_MANAGER_CHAT_ID = -1

You can control whether users have default access to your bot by modifying the USER_ROLE_DEFAULT and USER_ROLE_BOT_ACCESS parameters. The USER_ROLE_CHOOSE_MODEL parameter allows you to decide whether users can change their GPT model. By default, the gpt-3.5-turbo model is used.

@ijwfly ijwfly merged commit 4b33e87 into master Aug 6, 2023
@ijwfly ijwfly deleted the feature/allowed-list branch August 6, 2023 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant