Addind support for -1 unlimited check

This commit is contained in:
Silversthorn 2021-08-25 20:22:43 +02:00
parent 86ad734f4d
commit f4ca0f6559
3 changed files with 5 additions and 5 deletions

View File

@ -152,11 +152,13 @@ class Controller:
@staticmethod
def can_add_user(user_id):
#TODO: Complete if we need a User Addition limit
#return db_helper.can_add_in_crafty(user_id, Enum_Permissions_Crafty.User_Config)
return True
@staticmethod
def can_add_role(user_id):
#TODO: Complete if we need a User Addition limit
#return db_helper.can_add_in_crafty(user_id, Enum_Permissions_Crafty.Roles_Config)
return True
@staticmethod

View File

@ -494,7 +494,7 @@ class db_shortcuts:
can = crafty_permissions.has_permission(user_crafty.permissions, permission)
limit_list = db_helper.get_permission_quantity_list(user_id)
quantity_list = db_helper.get_created_quantity_list(user_id)
return can and quantity_list[permission.name] < limit_list[permission.name]
return can and ((quantity_list[permission.name] < limit_list[permission.name]) or limit_list[permission.name] == -1 )
@staticmethod
def add_server_creation(user_id):

View File

@ -711,7 +711,7 @@ class PanelHandler(BaseHandler):
if argument:
roles.add(role.role_id)
permissions_mask = "00000000"
permissions_mask = "000"
server_quantity = {}
for permission in self.controller.list_defined_crafty_permissions():
argument = int(float(
@ -729,7 +729,6 @@ class PanelHandler(BaseHandler):
))
if q_argument:
server_quantity[permission.name] = q_argument
else:
server_quantity[permission.name] = 0
@ -785,7 +784,7 @@ class PanelHandler(BaseHandler):
if argument:
roles.add(role.role_id)
permissions_mask = "00000000"
permissions_mask = "000"
server_quantity = {}
for permission in self.controller.list_defined_crafty_permissions():
argument = int(float(
@ -803,7 +802,6 @@ class PanelHandler(BaseHandler):
))
if q_argument:
server_quantity[permission.name] = q_argument
else:
server_quantity[permission.name] = 0