Changeset - 2fb94c52e20e
[Not reviewed]
rhodecode/controllers/api/api.py
Show inline comments
 
@@ -210,25 +210,25 @@ class ApiController(JSONRPCController):
 

	
 
        :param apiuser:
 
        :param repoid:
 
        :param userid:
 
        :param locked:
 
        """
 
        repo = get_repo_or_error(repoid)
 
        if HasPermissionAnyApi('hg.admin')(user=apiuser):
 
            pass
 
        elif HasRepoPermissionAnyApi('repository.admin',
 
                                     'repository.write')(user=apiuser,
 
                                                         repo_name=repo.repo_name):
 
            #make sure normal user does not pass someone else userid, 
 
            #make sure normal user does not pass someone else userid,
 
            #he is not allowed to do that
 
            if not isinstance(userid, Optional) and userid != apiuser.user_id:
 
                raise JSONRPCError(
 
                    'userid is not the same as your user'
 
                )
 
        else:
 
            raise JSONRPCError('repository `%s` does not exist' % (repoid))
 

	
 
        if isinstance(userid, Optional):
 
            userid = apiuser.user_id
 
        user = get_user_or_error(userid)
 
        locked = bool(locked)
 
@@ -261,25 +261,25 @@ class ApiController(JSONRPCController):
 
            ip_addr_server=self.ip_addr,
 
            user_ips=ips
 
        )
 

	
 
    def get_user(self, apiuser, userid=Optional(OAttr('apiuser'))):
 
        """"
 
        Get a user by username, or userid, if userid is given
 

	
 
        :param apiuser:
 
        :param userid:
 
        """
 
        if HasPermissionAnyApi('hg.admin')(user=apiuser) is False:
 
            #make sure normal user does not pass someone else userid, 
 
            #make sure normal user does not pass someone else userid,
 
            #he is not allowed to do that
 
            if not isinstance(userid, Optional) and userid != apiuser.user_id:
 
                raise JSONRPCError(
 
                    'userid is not the same as your user'
 
                )
 

	
 
        if isinstance(userid, Optional):
 
            userid = apiuser.user_id
 

	
 
        user = get_user_or_error(userid)
 
        data = user.get_api_data()
 
        data['permissions'] = AuthUser(user_id=user.user_id).permissions
rhodecode/lib/base.py
Show inline comments
 
@@ -35,26 +35,26 @@ log = logging.getLogger(__name__)
 
def _get_ip_addr(environ):
 
    proxy_key = 'HTTP_X_REAL_IP'
 
    proxy_key2 = 'HTTP_X_FORWARDED_FOR'
 
    def_key = 'REMOTE_ADDR'
 

	
 
    ip = environ.get(proxy_key)
 
    if ip:
 
        return ip
 

	
 
    ip = environ.get(proxy_key2)
 
    if ip:
 
        # HTTP_X_FORWARDED_FOR can have mutliple ips inside
 
        # the left-most being the original client, and each successive proxy 
 
        # that passed the request adding the IP address where it received the 
 
        # the left-most being the original client, and each successive proxy
 
        # that passed the request adding the IP address where it received the
 
        # request from.
 
        if ',' in ip:
 
            ip = ip.split(',')[0].strip()
 
        return ip
 

	
 
    ip = environ.get(def_key, '0.0.0.0')
 
    return ip
 

	
 

	
 
def _get_access_path(environ):
 
    path = environ.get('PATH_INFO')
 
    org_req = environ.get('pylons.original_request')
rhodecode/templates/admin/repos/repos.html
Show inline comments
 
@@ -63,25 +63,25 @@
 
      }
 
      YUD.get('repo_count').innerHTML = res.results.length;
 
      return res;
 
  }
 

	
 
  // main table sorting
 
  var myColumnDefs = [
 
      {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
 
      {key:"name",label:"${_('Name')}",sortable:true,
 
    	  sortOptions: { sortFunction: nameSort }},
 
      {key:"desc",label:"${_('Description')}",sortable:true},
 
      {key:"last_changeset",label:"${_('Tip')}",sortable:true,
 
          sortOptions: { sortFunction: revisionSort }},      
 
          sortOptions: { sortFunction: revisionSort }},
 
      {key:"owner",label:"${_('Owner')}",sortable:true},
 
      {key:"action",label:"${_('Action')}",sortable:false},
 
  ];
 

	
 
  var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
 
    sortedBy:{key:"name",dir:"asc"},
 
    paginator: new YAHOO.widget.Paginator({
 
        rowsPerPage: 25,
 
        alwaysVisible: false,
 
        template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
 
        pageLinks: 5,
 
        containerClass: 'pagination-wh',
rhodecode/templates/admin/users/user_edit_my_account.html
Show inline comments
 
@@ -91,25 +91,25 @@
 
            %endfor
 
            </tbody>
 
            </table>
 
            </div>
 
           %endfor
 
    </div>
 
    <div id="my_container" style="display:none">
 
        <div class="table yui-skin-sam" id="repos_list_wrap"></div>
 
        <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div>
 
    </div>
 
    <div id="pullrequests_container" class="table" style="display:none">
 
        ## loaded via AJAX
 
        ${_('Loading...')}    
 
        ${_('Loading...')}
 
    </div>
 
</div>
 

	
 
<script type="text/javascript">
 

	
 
var show_perms = function(e){
 
    YUD.addClass('show_perms', 'current');
 
    YUD.removeClass('show_my','current');
 
    YUD.removeClass('show_pullrequests','current');
 

	
 
    YUD.setStyle('my_container','display','none');
 
    YUD.setStyle('pullrequests_container','display','none');
 
@@ -193,32 +193,32 @@ function table_renderer(data){
 
          if (req) {
 
              req = req.toLowerCase();
 
              for (i = 0; i<data.length; i++) {
 
                  var pos = data[i].raw_name.toLowerCase().indexOf(req)
 
                  if (pos != -1) {
 
                      filtered.push(data[i]);
 
                  }
 
              }
 
              res.results = filtered;
 
          }
 
          return res;
 
      }
 
      
 

	
 
	  // main table sorting
 
	  var myColumnDefs = [
 
	      {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
 
	      {key:"name",label:"${_('Name')}",sortable:true,
 
	          sortOptions: { sortFunction: nameSort }},
 
	      {key:"last_changeset",label:"${_('Tip')}",sortable:true,
 
	          sortOptions: { sortFunction: revisionSort }},      
 
	          sortOptions: { sortFunction: revisionSort }},
 
	      {key:"action",label:"${_('Action')}",sortable:false},
 
	  ];
 

	
 
	  var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
 
	    sortedBy:{key:"name",dir:"asc"},
 
	    paginator: new YAHOO.widget.Paginator({
 
	        rowsPerPage: 50,
 
	        alwaysVisible: false,
 
	        template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
 
	        pageLinks: 5,
 
	        containerClass: 'pagination-wh',
 
	        currentPageClass: 'pager_curpage',
rhodecode/templates/admin/users/user_edit_my_account_repos.html
Show inline comments
 

	
rhodecode/templates/data_table/_dt_elements.html
Show inline comments
 
@@ -113,32 +113,31 @@
 
<%def name="repo_actions(repo_name)">
 
  <div>
 
    <div style="float:left">
 
    <a href="${h.url('repo_settings_home',repo_name=repo_name)}" title="${_('edit')}">
 
      ${h.submit('edit_%s' % repo_name,_('edit'),class_="edit_icon action_button")}
 
    </a>
 
    </div>
 
    <div style="float:left">
 
    ${h.form(h.url('repo', repo_name=repo_name),method='delete')}
 
      ${h.submit('remove_%s' % repo_name,_('delete'),class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this repository: %s') % repo_name+"');")}
 
    ${h.end_form()}
 
    </div>
 
  </div>  
 
  </div>
 
</%def>
 

	
 
<%def name="user_actions(user_id, username)">
 
  ${h.form(h.url('delete_user', id=user_id),method='delete')}
 
      ${h.submit('remove_',_('delete'),id="remove_user_%s" % user_id,
 
      class_="delete_icon action_button",onclick="return confirm('"+_('Confirm to delete this user: %s') % username+"');")}
 
  ${h.end_form()}
 
</%def>
 

	
 
<%def name="user_name(user_id, username)">
 
    ${h.link_to(username,h.url('edit_user', id=user_id))}
 
</%def>
 

	
 
<%def name="toggle_follow(repo_id)">
 
  <span id="follow_toggle_${repo_id}" class="following" title="${_('Stop following this repository')}"
 
        onclick="javascript:toggleFollowingRepo(this, ${repo_id},'${str(h.get_token())}')">
 
  </span>
 
</%def>
 

	
rhodecode/templates/index_base.html
Show inline comments
 
@@ -204,25 +204,25 @@
 
               MSG_SORTASC:"${_('Click to sort ascending')}",
 
               MSG_SORTDESC:"${_('Click to sort descending')}",
 
               MSG_EMPTY:"${_('No records found.')}",
 
               MSG_ERROR:"${_('Data error.')}",
 
               MSG_LOADING:"${_('Loading...')}",
 
              }
 
      );
 
      myDataTable.subscribe('postRenderEvent',function(oArgs) {
 
          tooltip_activate();
 
          quick_repo_menu();
 
          var func = function(node){
 
              return node.parentNode.parentNode.parentNode.parentNode;
 
          }          
 
          }
 
          q_filter('q_filter',YUQ('div.table tr td a.repo_name'),func);
 
      });
 

	
 
    </script>
 
    % else:
 
      <script>
 
        var data = ${c.data|n};
 
        var myDataSource = new YAHOO.util.DataSource(data);
 
        myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
 

	
 
        myDataSource.responseSchema = {
 
            resultsList: "records",
rhodecode/templates/journal/journal.html
Show inline comments
 
@@ -34,51 +34,51 @@
 
           <li>
 
             <span><a href="${h.url('journal_rss', api_key=c.rhodecode_user.api_key)}"><img class="icon" title="${_('RSS feed')}" alt="${_('RSS feed')}" src="${h.url('/images/icons/rss_16.png')}"/></a></span>
 
           </li>
 
           <li>
 
             <span><a href="${h.url('journal_atom', api_key=c.rhodecode_user.api_key)}"><img class="icon" title="${_('ATOM feed')}" alt="${_('ATOM feed')}" src="${h.url('/images/icons/atom.png')}"/></a></span>
 
           </li>
 
         </ul>
 
	    </div>
 
	    <div id="journal">${c.journal_data}</div>
 
    </div>
 
    <div class="box box-right">
 
        <!-- box / title -->
 
    
 

	
 
        <div class="title">
 
            <h5>
 
            <input class="q_filter_box" id="q_filter" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/>
 
            <input class="q_filter_box" id="q_filter_watched" size="15" type="text" name="filter" value="${_('quick filter...')}" style="display: none"/>
 
            </h5>
 
             <ul class="links" style="color:#DADADA">
 
               <li>
 
                 <span><a id="show_watched" class="link-white current" href="#watched">${_('Watched')}</a> </span>
 
               </li>
 
               <li>
 
                 <span><a id="show_my" class="link-white" href="#my">${_('My repos')}</a> </span>
 
               </li>
 
               %if h.HasPermissionAny('hg.admin','hg.create.repository')():
 
                 <li>
 
                   <span>${h.link_to(_('Add repo'),h.url('admin_settings_create_repository'))}</span>
 
                 </li>
 
               %endif
 
             </ul>
 
        </div>        
 
        
 
        </div>
 

	
 
        <!-- end box / title -->
 
        <div id="my_container" style="display:none">
 
            <div class="table yui-skin-sam" id="repos_list_wrap"></div>
 
            <div id="user-paginator" style="padding: 0px 0px 0px 20px"></div>
 
        </div>
 
        
 

	
 
        <div id="watched_container">
 
            <div class="table yui-skin-sam" id="watched_repos_list_wrap"></div>
 
            <div id="watched-user-paginator" style="padding: 0px 0px 0px 20px"></div>
 
        </div>
 
    </div>
 

	
 
    <script type="text/javascript">
 

	
 
    YUE.on('j_filter','click',function(){
 
        var jfilter = YUD.get('j_filter');
 
        if(YUD.hasClass(jfilter, 'initial')){
 
            jfilter.value = '';
 
@@ -95,56 +95,56 @@
 
        var val = YUD.get('j_filter').value;
 
        window.location = "${url.current(filter='__FILTER__')}".replace('__FILTER__',val);
 
    });
 
    fix_j_filter_width(YUD.get('j_filter').value.length);
 

	
 
    YUE.on('refresh','click',function(e){
 
        ypjax("${h.url.current(filter=c.search_term)}","journal",function(){
 
            show_more_event();
 
            tooltip_activate();
 
            show_changeset_tooltip();
 
            });
 
        YUE.preventDefault(e);
 
    });    
 
    
 
    });
 

	
 
    var show_my = function(e){
 
        YUD.setStyle('watched_container','display','none');
 
        YUD.setStyle('my_container','display','');
 
        YUD.setStyle('q_filter','display','');
 
        YUD.setStyle('q_filter_watched','display','none');
 

	
 
        YUD.addClass('show_my', 'current');
 
        YUD.removeClass('show_watched','current');
 
        
 

	
 
        if(!YUD.hasClass('show_my', 'loaded')){
 
            table_renderer(${c.data |n});
 
            YUD.addClass('show_my', 'loaded');
 
        }
 
    }
 
    YUE.on('show_my','click',function(e){
 
        show_my(e);
 
    })
 
    var show_watched = function(e){
 
    	YUD.setStyle('my_container','display','none');
 
        YUD.setStyle('watched_container','display','');
 
        YUD.setStyle('q_filter_watched','display','');
 
        YUD.setStyle('q_filter','display','none');
 

	
 
        YUD.addClass('show_watched', 'current');
 
        YUD.removeClass('show_my','current');
 
        if(!YUD.hasClass('show_watched', 'loaded')){
 
        	watched_renderer(${c.watched_data |n});
 
            YUD.addClass('show_watched', 'loaded');
 
        }        
 
        
 
        }
 

	
 
        return
 
        var nodes = YUQ('#watched_container .watched_repo a');
 
        var target = 'q_filter';
 
        var func = function(node){
 
            return node.parentNode.parentNode;
 
        }
 
        q_filter(target,nodes,func);
 
    }
 
    YUE.on('show_watched','click',function(e){
 
        show_watched(e);
 
    })
 
    //init watched
 
@@ -192,25 +192,25 @@
 
                    }
 
                }
 
                res.results = filtered;
 
            }
 
            return res;
 
        }
 
        // main table sorting
 
        var myColumnDefs = [
 
            {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
 
            {key:"name",label:"${_('Name')}",sortable:true,
 
                sortOptions: { sortFunction: nameSort }},
 
            {key:"last_changeset",label:"${_('Tip')}",sortable:true,
 
                sortOptions: { sortFunction: revisionSort }},      
 
                sortOptions: { sortFunction: revisionSort }},
 
            {key:"action",label:"${_('Action')}",sortable:false},
 
        ];
 

	
 
        var myDataTable = new YAHOO.widget.DataTable("watched_repos_list_wrap", myColumnDefs, myDataSource,{
 
          sortedBy:{key:"name",dir:"asc"},
 
          paginator: new YAHOO.widget.Paginator({
 
              rowsPerPage: 25,
 
              alwaysVisible: false,
 
              template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
 
              pageLinks: 5,
 
              containerClass: 'pagination-wh',
 
              currentPageClass: 'pager_curpage',
 
@@ -257,25 +257,25 @@
 
            if(!YUD.hasClass('q_filter_watched', 'loaded')){
 
                YUD.get('q_filter_watched').value = '';
 
                //TODO: load here full list later to do search within groups
 
                YUD.addClass('q_filter_watched', 'loaded');
 
            }
 
         });
 

	
 
        YUE.on('q_filter_watched','keyup',function (e) {
 
            clearTimeout(filterTimeout);
 
            filterTimeout = setTimeout(updateFilter,600);
 
        });
 
      }
 
    
 

	
 
    function table_renderer(data){
 
        var myDataSource = new YAHOO.util.DataSource(data);
 
        myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON;
 

	
 
        myDataSource.responseSchema = {
 
            resultsList: "records",
 
            fields: [
 
               {key:"menu"},
 
               {key:"raw_name"},
 
               {key:"name"},
 
               {key:"last_changeset"},
 
               {key:"action"},
 
@@ -296,25 +296,25 @@
 
                    }
 
                }
 
                res.results = filtered;
 
            }
 
            return res;
 
        }
 
        // main table sorting
 
        var myColumnDefs = [
 
            {key:"menu",label:"",sortable:false,className:"quick_repo_menu hidden"},
 
            {key:"name",label:"${_('Name')}",sortable:true,
 
                sortOptions: { sortFunction: nameSort }},
 
            {key:"last_changeset",label:"${_('Tip')}",sortable:true,
 
                sortOptions: { sortFunction: revisionSort }},      
 
                sortOptions: { sortFunction: revisionSort }},
 
            {key:"action",label:"${_('Action')}",sortable:false},
 
        ];
 

	
 
        var myDataTable = new YAHOO.widget.DataTable("repos_list_wrap", myColumnDefs, myDataSource,{
 
          sortedBy:{key:"name",dir:"asc"},
 
          paginator: new YAHOO.widget.Paginator({
 
              rowsPerPage: 25,
 
              alwaysVisible: false,
 
              template : "{PreviousPageLink} {FirstPageLink} {PageLinks} {LastPageLink} {NextPageLink}",
 
              pageLinks: 5,
 
              containerClass: 'pagination-wh',
 
              currentPageClass: 'pager_curpage',
 
@@ -360,16 +360,16 @@
 
        YUE.on('q_filter','click',function(){
 
            if(!YUD.hasClass('q_filter', 'loaded')){
 
                YUD.get('q_filter').value = '';
 
                //TODO: load here full list later to do search within groups
 
                YUD.addClass('q_filter', 'loaded');
 
            }
 
         });
 

	
 
        YUE.on('q_filter','keyup',function (e) {
 
            clearTimeout(filterTimeout);
 
            filterTimeout = setTimeout(updateFilter,600);
 
        });
 
      }    
 
    
 
      }
 

	
 
    </script>
 
</%def>
rhodecode/tests/functional/test_home.py
Show inline comments
 
@@ -97,13 +97,12 @@ merge" class="tooltip" href="/vcs_test_h
 
        self._set_l_dash(True)
 
        _make_repo(name='gr1/repo_in_group', repos_group=_make_group('gr1'))
 
        Session().commit()
 
        response = self.app.get(url('repos_group_home', group_name='gr1'))
 

	
 
        try:
 
            response.mustcontain("""gr1/repo_in_group""")
 
        finally:
 
            self._set_l_dash(False)
 
            RepoModel().delete('gr1/repo_in_group')
 
            ReposGroupModel().delete(repos_group='gr1', force_delete=True)
 
            Session().commit()
 
            
 
\ No newline at end of file
0 comments (0 inline, 0 general)