Ejemplo n.º 1
0
    def create(self):
        # Check for each repo the number of users
        nb_users = User.nb_used_users()

        # validate with the license
        l = LicenceChecker()
        # if the license is not valid
        l.is_valid(nb_users)

        # create the repo
        # change to the repository directory
        os.chdir(Repository.get_location())
        # Check if a repo already exsit
        if os.path.isdir(self.name + ".git"):
            raise Exception("Repository already exist")
        # create a bare repo
        subprocess.Popen(settings.GIT_PATH + " --bare init --shared " + self.name + ".git", shell=True).wait()

        # change directory to the git project
        os.chdir(Repository.get_location() + "/" + self.name + ".git")

        # remove whitespaces and tab in config file
        config_parser = RepoConfigParser(self.name)
        config_parser.remove_tabs()
        self.create_gitstack_section()

        # change to another directory
        os.chdir(settings.INSTALL_DIR)

        # Create an apache config file for the repository
        self.save()
Ejemplo n.º 2
0
    def add_user(self, user):
        nb_users = User.nb_used_users()

        # validate with the license
        l = LicenceChecker()
        if l.is_valid(nb_users):
            self.member_list.append(user)
Ejemplo n.º 3
0
    def create(self):
        # Check for each repo the number of users
        nb_users = User.nb_used_users(count_everyone=False)

        # validate with the license
        l = LicenceChecker()
        # if the license is not valid
        # check if the number of users is still under the quota
        l.is_valid(nb_users)

        # check if the user does not already exist
        if self in UserApache.retrieve_all():
            raise Exception("User already exist")
        # if there are no users, create a file
        if len(UserApache.retrieve_all()) == 1:
            passord_file = open(settings.INSTALL_DIR + "/data/passwdfile", "w")
            passord_file.write("")
            passord_file.close()
            pass
        # change directory to the password file
        os.chdir(settings.INSTALL_DIR + "/data")
        # Apache tool to create an user
        subprocess.Popen(
            settings.INSTALL_DIR + "/apache/bin/htpasswd.exe -b passwdfile " + self.username + " " + self.password
        )
Ejemplo n.º 4
0
 def add_user(self, user):
     nb_users = User.nb_used_users(count_everyone=False)
     
     # validate with the license
     l = LicenceChecker()
     if l.is_valid(nb_users):
         self.member_list.append(user)
Ejemplo n.º 5
0
 def create(self):
     # Check for each repo the number of users
     nb_users = User.nb_used_users(count_everyone=False)
     
     # validate with the license
     l = LicenceChecker()
     # if the license is not valid
     l.is_valid(nb_users)
     
     # create the repo
     # change to the repository directory
     os.chdir(Repository.get_location())
     # Check if a repo already exsit
     if os.path.isdir(self.name + ".git") :
         raise Exception("Repository already exist")
     # create a bare repo
     subprocess.Popen(settings.GIT_PATH + " --bare init --shared " + self.name + ".git", shell=True).wait()
     
     # change directory to the git project
     os.chdir(Repository.get_location() + "/" + self.name + ".git")
     
     # remove whitespaces and tab in config file
     config_parser = RepoConfigParser(self.name)
     config_parser.remove_tabs()
     self.create_gitstack_section()
     
     
     # change to another directory
     os.chdir(settings.INSTALL_DIR)
     
     
     # Create an apache config file for the repository
     self.save()
Ejemplo n.º 6
0
    def add_user(self, user):
        # Check for each repo the number of users
        nb_users = User.nb_used_users()

        # validate with the license
        l = LicenceChecker()
        if l.is_valid(nb_users):
            self.user_list.append(user)
Ejemplo n.º 7
0
 def add_user(self, user):
     
     # do not check license for the user everyone
     if not user.username == "everyone":
         # Check for each repo the number of users
         nb_users = User.nb_used_users(count_everyone=False)
         
         # validate with the license
         l = LicenceChecker()
         if l.is_valid(nb_users + 1):
             # an exception should be raised if license issue
             pass
     
     self.user_list.append(user)
Ejemplo n.º 8
0
 def create(self):
     # Check for each repo the number of users
     nb_users = User.nb_used_users(count_everyone=False)
     
     # validate with the license
     l = LicenceChecker()
     # if the license is not valid
     # check if the number of users is still under the quota
     l.is_valid(nb_users)
     
     # check if the user does not already exist
     if self in UserApache.retrieve_all():
         raise Exception("User already exist")
     # if there are no users, create a file
     if len(UserApache.retrieve_all()) == 1:
         passord_file = open(settings.INSTALL_DIR + '/data/passwdfile', 'w')
         passord_file.write('')
         passord_file.close()
         pass
     # change directory to the password file
     os.chdir(settings.INSTALL_DIR + '/data')
     # Apache tool to create an user
     subprocess.Popen(settings.INSTALL_DIR + '/apache/bin/htpasswd.exe -b passwdfile ' + self.username + ' ' + self.password)
Ejemplo n.º 9
0
    def add_user(self, user):

        # do not check license for the user everyone
        if not user.username == "everyone":
            # Check for each repo the number of users
            nb_users = User.nb_used_users(count_everyone=False)

            # validate with the license
            l = LicenceChecker()
            logger.debug("nb_users : " + str(nb_users))
            # if the user has already been added
            if User.is_user_already_added(user):
                # check license
                if l.is_valid(nb_users):
                    # an exception should be raised if license issue
                    pass
            # if not
            else:
                # check the license for one more license
                if l.is_valid(nb_users + 1):
                    # an exception should be raised if license issue
                    pass

        self.user_list.append(user)
Ejemplo n.º 10
0
 def add_user(self, user):
     
     # do not check license for the user everyone
     if not user.username == "everyone":
         # Check for each repo the number of users
         nb_users = User.nb_used_users(count_everyone=False)
         
         # validate with the license
         l = LicenceChecker()
         logger.debug("nb_users : " + str(nb_users))
         # if the user has already been added
         if User.is_user_already_added(user):
             # check license
             if l.is_valid(nb_users):
                 # an exception should be raised if license issue
                 pass
         # if not
         else: 
             # check the license for one more license
             if l.is_valid(nb_users + 1):
                 # an exception should be raised if license issue
                 pass
     
     self.user_list.append(user)