Blob Blame Raw

from model.rights import MyRights
from model.rights import InternalRights
from model.users import Users
from model.repositories import Repositories


class Model:
  def __init__(self, connection, translator, user_id = 0, superuser = False):
    self.connection = connection
    self.server = self.connection.server
    self.internal_rights = InternalRights(self.connection, user_id, superuser)
    self.myrights = MyRights(self.internal_rights)
    self.translator = translator
    
    self.users = Users(self)
    self.repositories = Repositories(self)

  def verify_path_entry(self, entry):
    return type(entry) is str and len(entry) < 200 and entry.isalnum()

  def verify_identifier(self, identifier):
    return self.verify_path_entry(identifier) and identifier.isidentifier()