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