Changeset - c3245a0452a3
[Not reviewed]
default
0 3 0
Marcin Kuzminski - 12 years ago 2013-06-21 00:36:01
marcin@python-works.com
Added --no-public-access / --public-access flags into setup-rhodecode
command to enable setup without public access
3 files changed with 23 insertions and 6 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/db_manage.py
Show inline comments
 
@@ -696,10 +696,18 @@ class DbManage(object):
 
    def create_default_user(self):
 
        log.info('creating default user')
 
        # create default user for handling default permissions.
 
        UserModel().create_or_update(username='default',
 
                              password=str(uuid.uuid1())[:8],
 
                              email='anonymous@rhodecode.org',
 
                              firstname='Anonymous', lastname='User')
 
        user = UserModel().create_or_update(username=User.DEFAULT_USER,
 
                                            password=str(uuid.uuid1())[:20],
 
                                            email='anonymous@rhodecode.org',
 
                                            firstname='Anonymous',
 
                                            lastname='User')
 
        # based on configuration options activate/deactive this user which
 
        # controlls anonymous access
 
        if self.cli_args.get('public_access') is False:
 
            log.info('Public access disabled')
 
            user.active = False
 
            Session().add(user)
 
            Session().commit()
 

	
 
    def create_permissions(self):
 
        """
rhodecode/lib/paster_commands/setup_rhodecode.py
Show inline comments
 
@@ -64,7 +64,16 @@ class Command(AbstractInstallCommand):
 
                       dest='force_ask',
 
                       default=None,
 
                       help='Force no to every question')
 

	
 
    parser.add_option('--public-access',
 
                       action='store_true',
 
                       dest='public_access',
 
                       default=None,
 
                       help='Enable public access on this installation (default)')
 
    parser.add_option('--no-public-access',
 
                       action='store_false',
 
                       dest='public_access',
 
                       default=None,
 
                       help='Disable public access on this installation ')
 
    def command(self):
 
        config_spec = self.args[0]
 
        section = self.options.section_name
rhodecode/tests/scripts/create_rc.sh
Show inline comments
 
psql -U postgres -h localhost -c 'drop database if exists rhodecode;'
 
psql -U postgres -h localhost -c 'create database rhodecode;'
 
paster setup-rhodecode rc.ini --force-yes --user=marcink --password=qweqwe --email=marcin@python-blog.com --repos=/home/marcink/repos
 
paster setup-rhodecode rc.ini --force-yes --user=marcink --password=qweqwe --email=marcin@python-blog.com --repos=/home/marcink/repos --no-public-access
 
API_KEY=`psql -R " " -A -U postgres -h localhost -c "select api_key from users where admin=TRUE" -d rhodecode | awk '{print $2}'`
 
echo "run those after running server"
 
paster serve rc.ini --pid-file=rc.pid --daemon
0 comments (0 inline, 0 general)