Example #1
0
def rest_security(request):
    # get http/https config
    if request.method == 'GET':
        # send back the port
        apache = Apache()
        http_config = {'http': apache.http, 'https': apache.https}
        json_reply = jsonpickle.encode(http_config, unpicklable=False)

        return HttpResponse(json_reply)

    # modify the apache port
    if request.method == 'PUT':
        data = json.loads(request.raw_post_data)
        http = data['http']
        https = data['https']

        apache = Apache()
        if http == True:
            apache.http = True
        else:
            apache.http = False
        if https == True:
            apache.https = True
        else:
            apache.https = False

        apache.save()
        apache.restart()

        if apache.http == False and apache.https == True:
            return HttpResponse(
                "Please reload the admin interface using https://localhost/gitstack/ ."
            )

        return HttpResponse("Security settings have been successfully saved.")
Example #2
0
def rest_port(request):
    # get the current port
    if request.method == 'GET':
        # send back the ports for http and https
        apache = Apache()
        http_config = {
            'httpPort': apache.http_port,
            'httpsPort': apache.https_port
        }
        json_reply = jsonpickle.encode(http_config, unpicklable=False)

        return HttpResponse(json_reply)

    # modify the apache port
    if request.method == 'PUT':
        data = json.loads(request.raw_post_data)
        http_port = data['httpPort']
        https_port = data['httpsPort']

        apache = Apache()
        apache.http_port = http_port
        apache.https_port = https_port

        apache.save()
        apache.restart()
        return HttpResponse(
            "Port changed. Please reload your browser to http://localhost:" +
            http_port + "/gitstack/")
Example #3
0
def rest_security(request):
    # get http/https config
    if request.method == 'GET':
        # send back the port 
        apache = Apache()
        http_config = {'http': apache.http, 'https': apache.https }
        json_reply = jsonpickle.encode(http_config, unpicklable = False)

        return HttpResponse(json_reply)
    
    # modify the apache port
    if request.method == 'PUT':
        data = json.loads(request.raw_post_data)
        http = data['http']
        https = data['https']
        
        apache = Apache()
        if http == True:
            apache.http = True
        else:
            apache.http = False
        if https == True:
            apache.https = True
        else:
            apache.https = False
        
        apache.save()
        apache.restart()

        if apache.http == False and apache.https == True:
            return HttpResponse("Please reload the admin interface using https://localhost/gitstack/ .")

        return HttpResponse("Security settings have been successfully saved.")
Example #4
0
    def proceed_first_setup(self):
        from gitstack.models import Apache

        # create a settings.ini file
        shutil.copy(settings.INSTALL_DIR + '/app/gitstack/config_template/settings.ini', settings.SETTINGS_PATH)
        
        # create a group file if it does not exist
        if not os.path.isfile(settings.GROUP_FILE_PATH):
            # create an empty group file
            group_file = open(settings.GROUP_FILE_PATH, 'w')
            group_file.write('')
            group_file.close()   
            
        # copy the self signed certificates
        self.copy_certificates()
        
        # save new apache configuration (update gitphp repo location)
        apache = Apache()
        apache.save()
Example #5
0
def rest_port(request):
    # get the current port
    if request.method == 'GET':
        # send back the ports for http and https
        apache = Apache()
        http_config = {'httpPort': apache.http_port, 'httpsPort': apache.https_port }
        json_reply = jsonpickle.encode(http_config, unpicklable = False)

        return HttpResponse(json_reply)
    
    # modify the apache port
    if request.method == 'PUT':
        data = json.loads(request.raw_post_data)
        http_port = data['httpPort']
        https_port = data['httpsPort']
        
        apache = Apache()
        apache.http_port = http_port
        apache.https_port = https_port
        
        apache.save()
        apache.restart()
        return HttpResponse("Port changed. Please reload your browser to http://localhost:" + http_port + "/gitstack/")
Example #6
0
    def proceed_first_setup(self):
        from gitstack.models import Apache

        # create a settings.ini file
        shutil.copy(settings.INSTALL_DIR + '/app/gitstack/config_template/settings.ini', settings.SETTINGS_PATH)
        
        # create a group file if it does not exist
        if not os.path.isfile(settings.GROUP_FILE_PATH):
            # create an empty group file
            group_file = open(settings.GROUP_FILE_PATH, 'w')
            group_file.write('')
            group_file.close()   
            
        # copy the self signed certificates
        self.copy_certificates()
        
        # write a file for l*c*s*ng purpose
        open(settings.INSTALL_DIR + '/data/core', 'w').close()

        
        # save new apache configuration (update gitphp repo location)
        apache = Apache()
        apache.save()