Show More
@@ -60,7 +60,7 b' class Permission(Base):' | |||||
60 |
|
60 | |||
61 | class Repo2Perm(Base): |
|
61 | class Repo2Perm(Base): | |
62 | __tablename__ = 'repo_to_perm' |
|
62 | __tablename__ = 'repo_to_perm' | |
63 |
__table_args__ = (UniqueConstraint('user_id |
|
63 | __table_args__ = (UniqueConstraint('user_id', 'repository'), {'useexisting':True}) | |
64 | repo2perm_id = Column("repo2perm_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=True) |
|
64 | repo2perm_id = Column("repo2perm_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=True) | |
65 | user_id = Column("user_id", INTEGER(), ForeignKey(u'users.user_id'), nullable=False, unique=None, default=None) |
|
65 | user_id = Column("user_id", INTEGER(), ForeignKey(u'users.user_id'), nullable=False, unique=None, default=None) | |
66 | permission_id = Column("permission_id", INTEGER(), ForeignKey(u'permissions.permission_id'), nullable=False, unique=None, default=None) |
|
66 | permission_id = Column("permission_id", INTEGER(), ForeignKey(u'permissions.permission_id'), nullable=False, unique=None, default=None) |
@@ -127,7 +127,9 b' class ValidRepoUser(formencode.validator' | |||||
127 | def to_python(self, value, state): |
|
127 | def to_python(self, value, state): | |
128 | sa = meta.Session |
|
128 | sa = meta.Session | |
129 | try: |
|
129 | try: | |
130 |
self.user_db = sa.query(User) |
|
130 | self.user_db = sa.query(User)\ | |
|
131 | .filter(User.active == True)\ | |||
|
132 | .filter(User.username == value).one() | |||
131 | except Exception: |
|
133 | except Exception: | |
132 | raise formencode.Invalid(_('This username is not valid'), |
|
134 | raise formencode.Invalid(_('This username is not valid'), | |
133 | value, state) |
|
135 | value, state) | |
@@ -176,7 +178,9 b' class ValidPerms(formencode.validators.F' | |||||
176 | sa = meta.Session |
|
178 | sa = meta.Session | |
177 | for k, v in perms_new: |
|
179 | for k, v in perms_new: | |
178 | try: |
|
180 | try: | |
179 |
self.user_db = sa.query(User) |
|
181 | self.user_db = sa.query(User)\ | |
|
182 | .filter(User.active == True)\ | |||
|
183 | .filter(User.username == k).one() | |||
180 | except Exception: |
|
184 | except Exception: | |
181 | msg = self.message('perm_new_user_name', |
|
185 | msg = self.message('perm_new_user_name', | |
182 | state=State_obj) |
|
186 | state=State_obj) |
@@ -43,7 +43,7 b' class RepoModel(object):' | |||||
43 |
|
43 | |||
44 | def get_users_js(self): |
|
44 | def get_users_js(self): | |
45 |
|
45 | |||
46 | users = self.sa.query(User).all() |
|
46 | users = self.sa.query(User).filter(User.active == True).all() | |
47 | u_tmpl = '''{id:%s, fname:"%s", lname:"%s", nname:"%s"},''' |
|
47 | u_tmpl = '''{id:%s, fname:"%s", lname:"%s", nname:"%s"},''' | |
48 | users_array = '[%s];' % '\n'.join([u_tmpl % (u.user_id, u.name, |
|
48 | users_array = '[%s];' % '\n'.join([u_tmpl % (u.user_id, u.name, | |
49 | u.lastname, u.username) |
|
49 | u.lastname, u.username) |
@@ -208,7 +208,7 b' table tr.parity1 {' | |||||
208 | font-size: 100%; |
|
208 | font-size: 100%; | |
209 | } |
|
209 | } | |
210 |
|
210 | |||
211 |
.ac |
|
211 | .ac .perm_ac{ | |
212 | width:15em; |
|
212 | width:15em; | |
213 | } |
|
213 | } | |
214 | /* styles for input field */ |
|
214 | /* styles for input field */ |
@@ -36,7 +36,7 b'' | |||||
36 | <tr> |
|
36 | <tr> | |
37 | <td>${_('Owner')}</td> |
|
37 | <td>${_('Owner')}</td> | |
38 | <td class='ac'> |
|
38 | <td class='ac'> | |
39 |
<div |
|
39 | <div class="perm_ac"> | |
40 | ${h.text('user',class_='yui-ac-input')} |
|
40 | ${h.text('user',class_='yui-ac-input')} | |
41 | <div id="owner_container"></div> |
|
41 | <div id="owner_container"></div> | |
42 | </div> |
|
42 | </div> | |
@@ -63,7 +63,7 b'' | |||||
63 | <td>${r2p.user.username}</td> |
|
63 | <td>${r2p.user.username}</td> | |
64 | </tr> |
|
64 | </tr> | |
65 | %else: |
|
65 | %else: | |
66 | <tr id=${id(r2p.user.username)}> |
|
66 | <tr id="id${id(r2p.user.username)}"> | |
67 | <td>${h.radio('perm_%s' % r2p.user.username,'repository.none')}</td> |
|
67 | <td>${h.radio('perm_%s' % r2p.user.username,'repository.none')}</td> | |
68 | <td>${h.radio('perm_%s' % r2p.user.username,'repository.read')}</td> |
|
68 | <td>${h.radio('perm_%s' % r2p.user.username,'repository.read')}</td> | |
69 | <td>${h.radio('perm_%s' % r2p.user.username,'repository.write')}</td> |
|
69 | <td>${h.radio('perm_%s' % r2p.user.username,'repository.write')}</td> | |
@@ -71,16 +71,15 b'' | |||||
71 | <td>${r2p.user.username}</td> |
|
71 | <td>${r2p.user.username}</td> | |
72 | <td> |
|
72 | <td> | |
73 | %if r2p.user.username !='default': |
|
73 | %if r2p.user.username !='default': | |
74 | <span class="delete_icon action_button" onclick="ajaxAction(${r2p.user.user_id},${id(r2p.user.username)})"> |
|
74 | <span class="delete_icon action_button" onclick="ajaxAction(${r2p.user.user_id},'${'id%s'%id(r2p.user.username)}')"> | |
75 | <script type="text/javascript"> |
|
75 | <script type="text/javascript"> | |
76 | function ajaxAction(user_id,field_id){ |
|
76 | function ajaxAction(user_id,field_id){ | |
77 | var sUrl = "${h.url('delete_repo_user',repo_name=c.repo_name)}"; |
|
77 | var sUrl = "${h.url('delete_repo_user',repo_name=c.repo_name)}"; | |
78 | var callback = { success:function(o){ |
|
78 | var callback = { success:function(o){ | |
79 |
|
|
79 | var tr = YAHOO.util.Dom.get(String(field_id)); | |
80 | }}; |
|
80 | tr.parentNode.removeChild(tr);}}; | |
81 | var postData = '_method=delete&user_id='+user_id; |
|
81 | var postData = '_method=delete&user_id='+user_id; | |
82 |
var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData); |
|
82 | var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);}; | |
83 | }; |
|
|||
84 | </script> |
|
83 | </script> | |
85 | </span> |
|
84 | </span> | |
86 | %endif |
|
85 | %endif | |
@@ -101,7 +100,7 b'' | |||||
101 | <td>${h.radio('perm_new_user','repository.write')}</td> |
|
100 | <td>${h.radio('perm_new_user','repository.write')}</td> | |
102 | <td>${h.radio('perm_new_user','repository.admin')}</td> |
|
101 | <td>${h.radio('perm_new_user','repository.admin')}</td> | |
103 | <td class='ac'> |
|
102 | <td class='ac'> | |
104 | <div id="perm_ac"> |
|
103 | <div class="perm_ac" id="perm_ac"> | |
105 | ${h.text('perm_new_user_name',class_='yui-ac-input')} |
|
104 | ${h.text('perm_new_user_name',class_='yui-ac-input')} | |
106 | <div id="perm_container"></div> |
|
105 | <div id="perm_container"></div> | |
107 | </div> |
|
106 | </div> |
General Comments 0
You need to be logged in to leave comments.
Login now