mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-17 16:50:53 +00:00
Remove is_Active reference to user accounts
Removed is_active references and checks for users accounts as the functionality does not align with project direction
This commit is contained in:
parent
f453380f5c
commit
54f3ee2185
4 changed files with 1 additions and 27 deletions
|
|
@ -7,7 +7,7 @@ from .models import User
|
|||
class CustomUserAdmin(UserAdmin):
|
||||
fieldsets = (
|
||||
(None, {'fields': ('username', 'password', 'avatar_config', 'groups')}),
|
||||
('Permissions', {'fields': ('is_active', 'is_staff', 'is_superuser', 'user_permissions')}),
|
||||
('Permissions', {'fields': ('is_staff', 'is_superuser', 'user_permissions')}),
|
||||
('Important dates', {'fields': ('last_login', 'date_joined')}),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ class UserSerializer(serializers.ModelSerializer):
|
|||
"channel_profiles",
|
||||
"custom_properties",
|
||||
"avatar_config",
|
||||
"is_active",
|
||||
"is_staff",
|
||||
"is_superuser",
|
||||
"last_login",
|
||||
|
|
@ -52,10 +51,8 @@ class UserSerializer(serializers.ModelSerializer):
|
|||
def create(self, validated_data):
|
||||
channel_profiles = validated_data.pop("channel_profiles", [])
|
||||
|
||||
is_active = validated_data.pop("is_active", True)
|
||||
user = User(**validated_data)
|
||||
user.set_password(validated_data["password"])
|
||||
user.is_active = is_active
|
||||
user.save()
|
||||
|
||||
user.channel_profiles.set(channel_profiles)
|
||||
|
|
@ -63,17 +60,6 @@ class UserSerializer(serializers.ModelSerializer):
|
|||
return user
|
||||
|
||||
def update(self, instance, validated_data):
|
||||
# Prevent disabling the last active admin account
|
||||
if 'is_active' in validated_data and not validated_data['is_active']:
|
||||
other_active_admins = User.objects.filter(
|
||||
user_level__gte=10,
|
||||
is_active=True
|
||||
).exclude(id=instance.id).exists()
|
||||
if not other_active_admins:
|
||||
raise serializers.ValidationError(
|
||||
{"is_active": "Cannot disable the last active admin account."}
|
||||
)
|
||||
|
||||
password = validated_data.pop("password", None)
|
||||
channel_profiles = validated_data.pop("channel_profiles", None)
|
||||
|
||||
|
|
|
|||
|
|
@ -1946,9 +1946,6 @@ def xc_get_user(request):
|
|||
|
||||
user = get_object_or_404(User, username=username)
|
||||
|
||||
if not user.is_active:
|
||||
return None
|
||||
|
||||
custom_properties = user.custom_properties or {}
|
||||
|
||||
if "xc_password" not in custom_properties:
|
||||
|
|
@ -2928,9 +2925,6 @@ def xc_movie_stream(request, username, password, stream_id, extension):
|
|||
|
||||
user = get_object_or_404(User, username=username)
|
||||
|
||||
if not user.is_active:
|
||||
return JsonResponse({"error": "Account is disabled"}, status=403)
|
||||
|
||||
custom_properties = user.custom_properties or {}
|
||||
|
||||
if "xc_password" not in custom_properties:
|
||||
|
|
@ -2968,9 +2962,6 @@ def xc_series_stream(request, username, password, stream_id, extension):
|
|||
|
||||
user = get_object_or_404(User, username=username)
|
||||
|
||||
if not user.is_active:
|
||||
return JsonResponse({"error": "Account is disabled"}, status=403)
|
||||
|
||||
custom_properties = user.custom_properties or {}
|
||||
|
||||
if "xc_password" not in custom_properties:
|
||||
|
|
|
|||
|
|
@ -514,9 +514,6 @@ def stream_ts(request, channel_id):
|
|||
def stream_xc(request, username, password, channel_id):
|
||||
user = get_object_or_404(User, username=username)
|
||||
|
||||
if not user.is_active:
|
||||
return JsonResponse({"error": "Account is disabled"}, status=403)
|
||||
|
||||
extension = pathlib.Path(channel_id).suffix
|
||||
channel_id = pathlib.Path(channel_id).stem
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue