##// END OF EJS Templates
users: description edit fixes...
marcink -
r4024:dbba29ef default
parent child Browse files
Show More
@@ -82,6 +82,7 b' class TestCreateUser(object):'
82 self.apikey, 'create_user',
82 self.apikey, 'create_user',
83 username=username,
83 username=username,
84 email=email,
84 email=email,
85 description='CTO of Things',
85 password='example')
86 password='example')
86 response = api_call(self.app, params)
87 response = api_call(self.app, params)
87
88
@@ -42,7 +42,8 b' class TestUpdateUser(object):'
42 ('extern_name', None),
42 ('extern_name', None),
43 ('active', False),
43 ('active', False),
44 ('active', True),
44 ('active', True),
45 ('password', 'newpass')
45 ('password', 'newpass'),
46 ('description', 'CTO 4 Life')
46 ])
47 ])
47 def test_api_update_user(self, name, expected, user_util):
48 def test_api_update_user(self, name, expected, user_util):
48 usr = user_util.create_user()
49 usr = user_util.create_user()
@@ -75,6 +75,7 b' def get_user(request, apiuser, userid=Op'
75 "extern_name": "rhodecode",
75 "extern_name": "rhodecode",
76 "extern_type": "rhodecode",
76 "extern_type": "rhodecode",
77 "firstname": "username",
77 "firstname": "username",
78 "description": "user description",
78 "ip_addresses": [],
79 "ip_addresses": [],
79 "language": null,
80 "language": null,
80 "last_login": "Timestamp",
81 "last_login": "Timestamp",
@@ -159,7 +160,7 b' def get_users(request, apiuser):'
159
160
160 @jsonrpc_method()
161 @jsonrpc_method()
161 def create_user(request, apiuser, username, email, password=Optional(''),
162 def create_user(request, apiuser, username, email, password=Optional(''),
162 firstname=Optional(''), lastname=Optional(''),
163 firstname=Optional(''), lastname=Optional(''), description=Optional(''),
163 active=Optional(True), admin=Optional(False),
164 active=Optional(True), admin=Optional(False),
164 extern_name=Optional('rhodecode'),
165 extern_name=Optional('rhodecode'),
165 extern_type=Optional('rhodecode'),
166 extern_type=Optional('rhodecode'),
@@ -185,6 +186,8 b' def create_user(request, apiuser, userna'
185 :type firstname: Optional(str)
186 :type firstname: Optional(str)
186 :param lastname: Set the new user surname.
187 :param lastname: Set the new user surname.
187 :type lastname: Optional(str)
188 :type lastname: Optional(str)
189 :param description: Set user description, or short bio. Metatags are allowed.
190 :type description: Optional(str)
188 :param active: Set the user as active.
191 :param active: Set the user as active.
189 :type active: Optional(``True`` | ``False``)
192 :type active: Optional(``True`` | ``False``)
190 :param admin: Give the new user admin rights.
193 :param admin: Give the new user admin rights.
@@ -250,6 +253,7 b' def create_user(request, apiuser, userna'
250 email = Optional.extract(email)
253 email = Optional.extract(email)
251 first_name = Optional.extract(firstname)
254 first_name = Optional.extract(firstname)
252 last_name = Optional.extract(lastname)
255 last_name = Optional.extract(lastname)
256 description = Optional.extract(description)
253 active = Optional.extract(active)
257 active = Optional.extract(active)
254 admin = Optional.extract(admin)
258 admin = Optional.extract(admin)
255 extern_type = Optional.extract(extern_type)
259 extern_type = Optional.extract(extern_type)
@@ -267,6 +271,7 b' def create_user(request, apiuser, userna'
267 last_name=last_name,
271 last_name=last_name,
268 active=active,
272 active=active,
269 admin=admin,
273 admin=admin,
274 description=description,
270 extern_type=extern_type,
275 extern_type=extern_type,
271 extern_name=extern_name,
276 extern_name=extern_name,
272 ))
277 ))
@@ -280,6 +285,7 b' def create_user(request, apiuser, userna'
280 email=schema_data['email'],
285 email=schema_data['email'],
281 firstname=schema_data['first_name'],
286 firstname=schema_data['first_name'],
282 lastname=schema_data['last_name'],
287 lastname=schema_data['last_name'],
288 description=schema_data['description'],
283 active=schema_data['active'],
289 active=schema_data['active'],
284 admin=schema_data['admin'],
290 admin=schema_data['admin'],
285 extern_type=schema_data['extern_type'],
291 extern_type=schema_data['extern_type'],
@@ -307,7 +313,7 b' def create_user(request, apiuser, userna'
307 def update_user(request, apiuser, userid, username=Optional(None),
313 def update_user(request, apiuser, userid, username=Optional(None),
308 email=Optional(None), password=Optional(None),
314 email=Optional(None), password=Optional(None),
309 firstname=Optional(None), lastname=Optional(None),
315 firstname=Optional(None), lastname=Optional(None),
310 active=Optional(None), admin=Optional(None),
316 description=Optional(None), active=Optional(None), admin=Optional(None),
311 extern_type=Optional(None), extern_name=Optional(None), ):
317 extern_type=Optional(None), extern_name=Optional(None), ):
312 """
318 """
313 Updates the details for the specified user, if that user exists.
319 Updates the details for the specified user, if that user exists.
@@ -331,6 +337,8 b' def update_user(request, apiuser, userid'
331 :type firstname: Optional(str)
337 :type firstname: Optional(str)
332 :param lastname: Set the new surname.
338 :param lastname: Set the new surname.
333 :type lastname: Optional(str)
339 :type lastname: Optional(str)
340 :param description: Set user description, or short bio. Metatags are allowed.
341 :type description: Optional(str)
334 :param active: Set the new user as active.
342 :param active: Set the new user as active.
335 :type active: Optional(``True`` | ``False``)
343 :type active: Optional(``True`` | ``False``)
336 :param admin: Give the user admin rights.
344 :param admin: Give the user admin rights.
@@ -379,6 +387,7 b' def update_user(request, apiuser, userid'
379 store_update(updates, email, 'email')
387 store_update(updates, email, 'email')
380 store_update(updates, firstname, 'name')
388 store_update(updates, firstname, 'name')
381 store_update(updates, lastname, 'lastname')
389 store_update(updates, lastname, 'lastname')
390 store_update(updates, description, 'description')
382 store_update(updates, active, 'active')
391 store_update(updates, active, 'active')
383 store_update(updates, admin, 'admin')
392 store_update(updates, admin, 'admin')
384 store_update(updates, extern_name, 'extern_name')
393 store_update(updates, extern_name, 'extern_name')
@@ -335,6 +335,7 b' class TestAdminUsersView(TestController)'
335 response = self.app.post(route_path('users_create'), params={
335 response = self.app.post(route_path('users_create'), params={
336 'username': username,
336 'username': username,
337 'password': password,
337 'password': password,
338 'description': 'mr CTO',
338 'password_confirmation': password_confirmation,
339 'password_confirmation': password_confirmation,
339 'firstname': name,
340 'firstname': name,
340 'active': True,
341 'active': True,
@@ -383,6 +384,7 b' class TestAdminUsersView(TestController)'
383 'name': name,
384 'name': name,
384 'active': False,
385 'active': False,
385 'lastname': lastname,
386 'lastname': lastname,
387 'description': 'mr CTO',
386 'email': email,
388 'email': email,
387 'csrf_token': self.csrf_token,
389 'csrf_token': self.csrf_token,
388 })
390 })
@@ -420,6 +422,7 b' class TestAdminUsersView(TestController)'
420 ('email', {'email': 'some@email.com'}),
422 ('email', {'email': 'some@email.com'}),
421 ('language', {'language': 'de'}),
423 ('language', {'language': 'de'}),
422 ('language', {'language': 'en'}),
424 ('language', {'language': 'en'}),
425 ('description', {'description': 'hello CTO'}),
423 # ('new_password', {'new_password': 'foobar123',
426 # ('new_password', {'new_password': 'foobar123',
424 # 'password_confirmation': 'foobar123'})
427 # 'password_confirmation': 'foobar123'})
425 ])
428 ])
@@ -1062,6 +1062,7 b' class User(Base, BaseModel):'
1062 'username': user.username,
1062 'username': user.username,
1063 'firstname': user.name,
1063 'firstname': user.name,
1064 'lastname': user.lastname,
1064 'lastname': user.lastname,
1065 'description': user.description,
1065 'email': user.email,
1066 'email': user.email,
1066 'emails': user.emails,
1067 'emails': user.emails,
1067 }
1068 }
@@ -226,7 +226,7 b' class UserModel(BaseModel):'
226 active=True, admin=False, extern_type=None, extern_name=None,
226 active=True, admin=False, extern_type=None, extern_name=None,
227 cur_user=None, plugin=None, force_password_change=False,
227 cur_user=None, plugin=None, force_password_change=False,
228 allow_to_create_user=True, create_repo_group=None,
228 allow_to_create_user=True, create_repo_group=None,
229 updating_user_id=None, language=None, description=None,
229 updating_user_id=None, language=None, description='',
230 strict_creation_check=True):
230 strict_creation_check=True):
231 """
231 """
232 Creates a new instance if not found, or updates current one
232 Creates a new instance if not found, or updates current one
@@ -251,6 +251,8 b' class UserModel(BaseModel):'
251 :param updating_user_id: if we set it up this is the user we want to
251 :param updating_user_id: if we set it up this is the user we want to
252 update this allows to editing username.
252 update this allows to editing username.
253 :param language: language of user from interface.
253 :param language: language of user from interface.
254 :param description: user description
255 :param strict_creation_check: checks for allowed creation license wise etc.
254
256
255 :returns: new User object with injected `is_new_user` attribute.
257 :returns: new User object with injected `is_new_user` attribute.
256 """
258 """
@@ -103,6 +103,9 b' class UserSchema(colander.Schema):'
103 last_name = colander.SchemaNode(
103 last_name = colander.SchemaNode(
104 colander.String(), missing='')
104 colander.String(), missing='')
105
105
106 description = colander.SchemaNode(
107 colander.String(), missing='')
108
106 active = colander.SchemaNode(
109 active = colander.SchemaNode(
107 types.StringBooleanType(),
110 types.StringBooleanType(),
108 missing=False)
111 missing=False)
@@ -71,7 +71,13 b''
71 <label for="description">${_('Description')}:</label>
71 <label for="description">${_('Description')}:</label>
72 </div>
72 </div>
73 <div class="input textarea editor">
73 <div class="input textarea editor">
74 ${h.textarea('description', class_="medium")}
74 ${h.textarea('description', rows=10, class_="medium")}
75 <% metatags_url = h.literal('''<a href="#metatagsShow" onclick="$('#meta-tags-desc').toggle();return false">meta-tags</a>''') %>
76 <span class="help-block">${_('Plain text format with support of {metatags}. Add a README file for longer descriptions').format(metatags=metatags_url)|n}</span>
77 <span id="meta-tags-desc" style="display: none">
78 <%namespace name="dt" file="/data_table/_dt_elements.mako"/>
79 ${dt.metatags_help()}
80 </span>
75 </div>
81 </div>
76 </div>
82 </div>
77 <div class="field">
83 <div class="field">
@@ -231,6 +231,7 b' class Fixture(object):'
231 'email': '%s+test@rhodecode.org' % name,
231 'email': '%s+test@rhodecode.org' % name,
232 'firstname': 'TestUser',
232 'firstname': 'TestUser',
233 'lastname': 'Test',
233 'lastname': 'Test',
234 'description': 'test description',
234 'active': True,
235 'active': True,
235 'admin': False,
236 'admin': False,
236 'extern_type': 'rhodecode',
237 'extern_type': 'rhodecode',
General Comments 0
You need to be logged in to leave comments. Login now