Changeset - 91ff741c4de5
[Not reviewed]
beta
0 4 0
Mads Kiilerich - 13 years ago 2013-03-28 01:10:45
madski@unity3d.com
spelling: chosen
4 files changed with 15 insertions and 15 deletions:
0 comments (0 inline, 0 general)
docs/setup.rst
Show inline comments
 
@@ -607,97 +607,97 @@ Here is a sample configuration file for 
 
            ServerAlias hg.myserver.com
 

	
 
            <Proxy *>
 
              Order allow,deny
 
              Allow from all
 
            </Proxy>
 

	
 
            #important !
 
            #Directive to properly generate url (clone url) for pylons
 
            ProxyPreserveHost On
 

	
 
            #rhodecode instance
 
            ProxyPass / http://127.0.0.1:5000/
 
            ProxyPassReverse / http://127.0.0.1:5000/
 

	
 
            #to enable https use line below
 
            #SetEnvIf X-Url-Scheme https HTTPS=1
 

	
 
    </VirtualHost>
 

	
 

	
 
Additional tutorial
 
http://wiki.pylonshq.com/display/pylonscookbook/Apache+as+a+reverse+proxy+for+Pylons
 

	
 

	
 
Apache as subdirectory
 
----------------------
 

	
 
Apache subdirectory part::
 

	
 
    <Location /<someprefix> >
 
      ProxyPass http://127.0.0.1:5000/<someprefix>
 
      ProxyPassReverse http://127.0.0.1:5000/<someprefix>
 
      SetEnvIf X-Url-Scheme https HTTPS=1
 
    </Location>
 

	
 
Besides the regular apache setup you will need to add the following line
 
into [app:main] section of your .ini file::
 

	
 
    filter-with = proxy-prefix
 

	
 
Add the following at the end of the .ini file::
 

	
 
    [filter:proxy-prefix]
 
    use = egg:PasteDeploy#prefix
 
    prefix = /<someprefix>
 

	
 

	
 
then change <someprefix> into your choosen prefix
 
then change <someprefix> into your chosen prefix
 

	
 
Apache's WSGI config
 
--------------------
 

	
 
Alternatively, RhodeCode can be set up with Apache under mod_wsgi. For
 
that, you'll need to:
 

	
 
- Install mod_wsgi. If using a Debian-based distro, you can install
 
  the package libapache2-mod-wsgi::
 

	
 
    aptitude install libapache2-mod-wsgi
 

	
 
- Enable mod_wsgi::
 

	
 
    a2enmod wsgi
 

	
 
- Create a wsgi dispatch script, like the one below. Make sure you
 
  check the paths correctly point to where you installed RhodeCode
 
  and its Python Virtual Environment.
 
- Enable the WSGIScriptAlias directive for the wsgi dispatch script,
 
  as in the following example. Once again, check the paths are
 
  correctly specified.
 

	
 
Here is a sample excerpt from an Apache Virtual Host configuration file::
 

	
 
    WSGIDaemonProcess pylons \
 
        threads=4 \
 
        python-path=/home/web/rhodecode/pyenv/lib/python2.6/site-packages
 
    WSGIScriptAlias / /home/web/rhodecode/dispatch.wsgi
 
    WSGIPassAuthorization On
 

	
 
.. note::
 
   when running apache as root please add: `user=www-data group=www-data`
 
   into above configuration
 

	
 
.. note::
 
   Running RhodeCode in multiprocess mode in apache is not supported,
 
   make sure you don't specify `processes=num` directive in the config
 

	
 

	
 
Example wsgi dispatch script::
 

	
 
    import os
 
    os.environ["HGENCODING"] = "UTF-8"
 
    os.environ['PYTHON_EGG_CACHE'] = '/home/web/rhodecode/.egg-cache'
 

	
 
    # sometimes it's needed to set the curent dir
 
    os.chdir('/home/web/rhodecode/')
rhodecode/public/js/rhodecode.js
Show inline comments
 
@@ -1999,177 +1999,177 @@ var addPermAction = function(_html, user
 
    var elmts = YUD.getElementsByClassName('last_new_member');
 
    var last_node = elmts[elmts.length-1];
 
    if (last_node){
 
       var next_id = (YUD.getElementsByClassName('new_members')).length;
 
       _html = _html.format(next_id);
 
       last_node.innerHTML = _html;
 
       YUD.setStyle(last_node, 'display', '');
 
       YUD.removeClass(last_node, 'last_new_member');
 
       MembersAutoComplete("perm_new_member_name_"+next_id, 
 
               "perm_container_"+next_id, users_list, groups_list);          
 
       //create new last NODE
 
       var el = document.createElement('tr');
 
       el.id = 'add_perm_input';
 
       YUD.addClass(el,'last_new_member');
 
       YUD.addClass(el,'new_members');
 
       YUD.insertAfter(el, last_node);
 
    }	
 
}
 

	
 
/* Multi selectors */
 

	
 
var MultiSelectWidget = function(selected_id, available_id, form_id){
 

	
 

	
 
	//definition of containers ID's
 
	var selected_container = selected_id;
 
	var available_container = available_id;
 
	
 
	//temp container for selected storage.
 
	var cache = new Array();
 
	var av_cache = new Array();
 
	var c =  YUD.get(selected_container);
 
	var ac = YUD.get(available_container);
 
	
 
	//get only selected options for further fullfilment
 
	for(var i = 0;node =c.options[i];i++){
 
	    if(node.selected){
 
	        //push selected to my temp storage left overs :)
 
	        cache.push(node);
 
	    }
 
	}
 
	
 
	//get all available options to cache
 
	for(var i = 0;node =ac.options[i];i++){
 
	        //push selected to my temp storage left overs :)
 
	        av_cache.push(node);
 
	}
 
	
 
	//fill available only with those not in choosen
 
	//fill available only with those not in chosen
 
	ac.options.length=0;
 
	tmp_cache = new Array();
 
	
 
	for(var i = 0;node = av_cache[i];i++){
 
	    var add = true;
 
	    for(var i2 = 0;node_2 = cache[i2];i2++){
 
	        if(node.value == node_2.value){
 
	            add=false;
 
	            break;
 
	        }
 
	    }
 
	    if(add){
 
	        tmp_cache.push(new Option(node.text, node.value, false, false));
 
	    }
 
	}
 
	
 
	for(var i = 0;node = tmp_cache[i];i++){
 
	    ac.options[i] = node;
 
	}
 
	
 
	function prompts_action_callback(e){
 
	
 
	    var choosen = YUD.get(selected_container);
 
	    var chosen = YUD.get(selected_container);
 
	    var available = YUD.get(available_container);
 
	
 
	    //get checked and unchecked options from field
 
	    function get_checked(from_field){
 
	        //temp container for storage.
 
	        var sel_cache = new Array();
 
	        var oth_cache = new Array();
 
	
 
	        for(var i = 0;node = from_field.options[i];i++){
 
	            if(node.selected){
 
	                //push selected fields :)
 
	                sel_cache.push(node);
 
	            }
 
	            else{
 
	                oth_cache.push(node)
 
	            }
 
	        }
 
	
 
	        return [sel_cache,oth_cache]
 
	    }
 
	
 
	    //fill the field with given options
 
	    function fill_with(field,options){
 
	        //clear firtst
 
	        field.options.length=0;
 
	        for(var i = 0;node = options[i];i++){
 
	                field.options[i]=new Option(node.text, node.value,
 
	                        false, false);
 
	        }
 
	
 
	    }
 
	    //adds to current field
 
	    function add_to(field,options){
 
	        for(var i = 0;node = options[i];i++){
 
	                field.appendChild(new Option(node.text, node.value,
 
	                        false, false));
 
	        }
 
	    }
 
	
 
	    // add action
 
	    if (this.id=='add_element'){
 
	        var c = get_checked(available);
 
	        add_to(choosen,c[0]);
 
	        add_to(chosen,c[0]);
 
	        fill_with(available,c[1]);
 
	    }
 
	    // remove action
 
	    if (this.id=='remove_element'){
 
	        var c = get_checked(choosen);
 
	        var c = get_checked(chosen);
 
	        add_to(available,c[0]);
 
	        fill_with(choosen,c[1]);
 
	        fill_with(chosen,c[1]);
 
	    }
 
	    // add all elements
 
	    if(this.id=='add_all_elements'){
 
	        for(var i=0; node = available.options[i];i++){
 
	                choosen.appendChild(new Option(node.text,
 
	                chosen.appendChild(new Option(node.text,
 
	                        node.value, false, false));
 
	        }
 
	        available.options.length = 0;
 
	    }
 
	    //remove all elements
 
	    if(this.id=='remove_all_elements'){
 
	        for(var i=0; node = choosen.options[i];i++){
 
	        for(var i=0; node = chosen.options[i];i++){
 
	            available.appendChild(new Option(node.text,
 
	                    node.value, false, false));
 
	        }
 
	        choosen.options.length = 0;
 
	        chosen.options.length = 0;
 
	    }
 
	
 
	}
 
	
 
	YUE.addListener(['add_element','remove_element',
 
	               'add_all_elements','remove_all_elements'],'click',
 
	               prompts_action_callback)
 
	if (form_id !== undefined) {
 
		YUE.addListener(form_id,'submit',function(){
 
		    var choosen = YUD.get(selected_container);
 
		    for (var i = 0; i < choosen.options.length; i++) {
 
		        choosen.options[i].selected = 'selected';
 
		    var chosen = YUD.get(selected_container);
 
		    for (var i = 0; i < chosen.options.length; i++) {
 
		        chosen.options[i].selected = 'selected';
 
		    }
 
		});
 
	}
 
}
 

	
 

	
 
// global hooks after DOM is loaded
 

	
 
YUE.onDOMReady(function(){
 
	YUE.on(YUQ('.diff-collapse-button'), 'click', function(e){
 
		var button = e.currentTarget;
 
		var t = YUD.get(button).getAttribute('target');
 
	    console.log(t);
 
		if(YUD.hasClass(t, 'hidden')){
 
			YUD.removeClass(t, 'hidden');
 
			YUD.get(button).innerHTML = "&uarr; {0} &uarr;".format(_TM['Collapse diff']);
 
		}
 
		else if(!YUD.hasClass(t, 'hidden')){
 
			YUD.addClass(t, 'hidden');
 
			YUD.get(button).innerHTML = "&darr; {0} &darr;".format(_TM['Expand diff']);
 
		}
 
	});
 
	
 
	
 
	
 
});
 

	
rhodecode/templates/admin/permissions/permissions.html
Show inline comments
 
## -*- coding: utf-8 -*-
 
<%inherit file="/base/base.html"/>
 

	
 
<%def name="title()">
 
    ${_('Permissions administration')} &middot; ${c.rhodecode_name}
 
</%def>
 

	
 
<%def name="breadcrumbs_links()">
 
    ${h.link_to(_('Admin'),h.url('admin_home'))}
 
    &raquo;
 
    ${_('permissions')}
 
</%def>
 

	
 
<%def name="page_nav()">
 
    ${self.menu('admin')}
 
</%def>
 

	
 
<%def name="main()">
 
<div class="box box-left">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <h3>${_('Default permissions')}</h3>
 
    ${h.form(url('permission', id='default'),method='put')}
 
    <div class="form">
 
        <!-- fields -->
 
        <div class="fields">
 
            <div class="field">
 
                <div class="label label-checkbox">
 
                    <label for="anonymous">${_('Anonymous access')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    <div class="checkbox">
 
                        ${h.checkbox('anonymous',True)}
 
                    </div>
 
                </div>
 
            </div>
 
            <div class="field">
 
                <div class="label">
 
                    <label for="default_repo_perm">${_('Repository')}:</label>
 
                </div>
 
                <div class="select">
 
                    ${h.select('default_repo_perm','',c.repo_perms_choices)}
 

	
 
                    ${h.checkbox('overwrite_default_repo','true')}
 
                    <label for="overwrite_default_repo">
 
                    <span class="tooltip"
 
                    title="${h.tooltip(_('All default permissions on each repository will be reset to choosen permission, note that all custom default permission on repositories will be lost'))}">
 
                    title="${h.tooltip(_('All default permissions on each repository will be reset to chosen permission, note that all custom default permission on repositories will be lost'))}">
 
                    ${_('overwrite existing settings')}</span> </label>
 
                </div>
 
            </div>
 
            <div class="field">
 
                <div class="label">
 
                    <label for="default_group_perm">${_('Repository group')}:</label>
 
                </div>
 
                <div class="select">
 
                    ${h.select('default_group_perm','',c.group_perms_choices)}
 
                    ${h.checkbox('overwrite_default_group','true')}
 
                    <label for="overwrite_default_group">
 
                    <span class="tooltip"
 
                    title="${h.tooltip(_('All default permissions on each repository group will be reset to choosen permission, note that all custom default permission on repository groups will be lost'))}">
 
                    title="${h.tooltip(_('All default permissions on each repository group will be reset to chosen permission, note that all custom default permission on repository groups will be lost'))}">
 
                    ${_('overwrite existing settings')}</span> </label>
 

	
 
                </div>
 
            </div>
 
            <div class="field">
 
                <div class="label">
 
                    <label for="default_register">${_('Registration')}:</label>
 
                </div>
 
                <div class="select">
 
                    ${h.select('default_register','',c.register_choices)}
 
                </div>
 
            </div>
 
             <div class="field">
 
                <div class="label">
 
                    <label for="default_create">${_('Repository creation')}:</label>
 
                </div>
 
                <div class="select">
 
                    ${h.select('default_create','',c.create_choices)}
 
                </div>
 
             </div>
 
             <div class="field">
 
                <div class="label">
 
                    <label for="default_fork">${_('Repository forking')}:</label>
 
                </div>
 
                <div class="select">
 
                    ${h.select('default_fork','',c.fork_choices)}
 
                </div>
 
             </div>
 
            <div class="buttons">
 
              ${h.submit('save',_('Save'),class_="ui-btn large")}
 
              ${h.reset('reset',_('Reset'),class_="ui-btn large")}
 
            </div>
 
        </div>
 
    </div>
 
    ${h.end_form()}
 
</div>
 

	
 
<div style="min-height:780px" class="box box-right">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>${_('Default User Permissions')}</h5>
 
    </div>
 

	
 
    ## permissions overview
 
    <div id="perms" class="table">
 
           %for section in sorted(c.perm_user.permissions.keys()):
 
              <div class="perms_section_head">${section.replace("_"," ").capitalize()}</div>
 
              %if not c.perm_user.permissions[section]:
rhodecode/templates/admin/users_groups/users_group_edit.html
Show inline comments
 
@@ -10,97 +10,97 @@
 
    &raquo;
 
    ${h.link_to(_('UserGroups'),h.url('users_groups'))}
 
    &raquo;
 
    ${_('edit')} "${c.users_group.users_group_name}"
 
</%def>
 

	
 
<%def name="page_nav()">
 
    ${self.menu('admin')}
 
</%def>
 

	
 
<%def name="main()">
 
<div class="box box-left">
 
    <!-- box / title -->
 
    <div class="title">
 
        ${self.breadcrumbs()}
 
    </div>
 
    <!-- end box / title -->
 
    ${h.form(url('users_group', id=c.users_group.users_group_id),method='put', id='edit_users_group')}
 
    <div class="form">
 
        <!-- fields -->
 
            <div class="fields">
 
                 <div class="field">
 
                    <div class="label">
 
                        <label for="users_group_name">${_('Group name')}:</label>
 
                    </div>
 
                    <div class="input">
 
                        ${h.text('users_group_name',class_='small')}
 
                    </div>
 
                 </div>
 

	
 
                 <div class="field">
 
                    <div class="label label-checkbox">
 
                        <label for="users_group_active">${_('Active')}:</label>
 
                    </div>
 
                    <div class="checkboxes">
 
                        ${h.checkbox('users_group_active',value=True)}
 
                    </div>
 
                 </div>
 
                <div class="field">
 
                    <div class="label">
 
                        <label for="users_group_active">${_('Members')}:</label>
 
                    </div>
 
                    <div class="select">
 
                        <table>
 
                                <tr>
 
                                    <td>
 
                                        <div>
 
                                            <div style="float:left">
 
                                                <div class="text" style="padding: 0px 0px 6px;">${_('Choosen group members')}</div>
 
                                                <div class="text" style="padding: 0px 0px 6px;">${_('Chosen group members')}</div>
 
                                                ${h.select('users_group_members',[x[0] for x in c.group_members],c.group_members,multiple=True,size=8,style="min-width:210px")}
 
                                               <div  id="remove_all_elements" style="cursor:pointer;text-align:center">
 
                                                   ${_('Remove all elements')}
 
                                                   <img alt="remove" style="vertical-align:text-bottom" src="${h.url('/images/icons/arrow_right.png')}"/>
 
                                               </div>
 
                                            </div>
 
                                            <div style="float:left;width:20px;padding-top:50px">
 
                                                <img alt="add" id="add_element"
 
                                                    style="padding:2px;cursor:pointer"
 
                                                    src="${h.url('/images/icons/arrow_left.png')}"/>
 
                                                <br />
 
                                                <img alt="remove" id="remove_element"
 
                                                    style="padding:2px;cursor:pointer"
 
                                                    src="${h.url('/images/icons/arrow_right.png')}"/>
 
                                            </div>
 
                                            <div style="float:left">
 
                                                 <div class="text" style="padding: 0px 0px 6px;">${_('Available members')}</div>
 
                                                 ${h.select('available_members',[],c.available_members,multiple=True,size=8,style="min-width:210px")}
 
                                                 <div id="add_all_elements" style="cursor:pointer;text-align:center">
 
                                                       <img alt="add" style="vertical-align:text-bottom" src="${h.url('/images/icons/arrow_left.png')}"/>
 
                                                        ${_('Add all elements')}
 
                                                 </div>
 
                                            </div>
 
                                        </div>
 
                                    </td>
 
                                </tr>
 
                        </table>
 
                    </div>
 

	
 
                </div>
 
                <div class="buttons">
 
                  ${h.submit('save',_('save'),class_="ui-btn large")}
 
                </div>
 
            </div>
 
    </div>
 
${h.end_form()}
 
</div>
 

	
 
<div class="box box-right">
 
    <!-- box / title -->
 
    <div class="title">
 
        <h5>${_('Permissions')}</h5>
 
    </div>
 
    ${h.form(url('users_group_perm', id=c.users_group.users_group_id), method='put')}
 
    <div class="form">
 
        <!-- fields -->
 
        <div class="fields">
 
             <div class="field">
0 comments (0 inline, 0 general)