diff --git a/rhodecode/api/tests/test_create_user.py b/rhodecode/api/tests/test_create_user.py --- a/rhodecode/api/tests/test_create_user.py +++ b/rhodecode/api/tests/test_create_user.py @@ -82,6 +82,7 @@ class TestCreateUser(object): self.apikey, 'create_user', username=username, email=email, + description='CTO of Things', password='example') response = api_call(self.app, params) diff --git a/rhodecode/api/tests/test_update_user.py b/rhodecode/api/tests/test_update_user.py --- a/rhodecode/api/tests/test_update_user.py +++ b/rhodecode/api/tests/test_update_user.py @@ -42,7 +42,8 @@ class TestUpdateUser(object): ('extern_name', None), ('active', False), ('active', True), - ('password', 'newpass') + ('password', 'newpass'), + ('description', 'CTO 4 Life') ]) def test_api_update_user(self, name, expected, user_util): usr = user_util.create_user() diff --git a/rhodecode/api/views/user_api.py b/rhodecode/api/views/user_api.py --- a/rhodecode/api/views/user_api.py +++ b/rhodecode/api/views/user_api.py @@ -75,6 +75,7 @@ def get_user(request, apiuser, userid=Op "extern_name": "rhodecode", "extern_type": "rhodecode", "firstname": "username", + "description": "user description", "ip_addresses": [], "language": null, "last_login": "Timestamp", @@ -159,7 +160,7 @@ def get_users(request, apiuser): @jsonrpc_method() def create_user(request, apiuser, username, email, password=Optional(''), - firstname=Optional(''), lastname=Optional(''), + firstname=Optional(''), lastname=Optional(''), description=Optional(''), active=Optional(True), admin=Optional(False), extern_name=Optional('rhodecode'), extern_type=Optional('rhodecode'), @@ -185,6 +186,8 @@ def create_user(request, apiuser, userna :type firstname: Optional(str) :param lastname: Set the new user surname. :type lastname: Optional(str) + :param description: Set user description, or short bio. Metatags are allowed. + :type description: Optional(str) :param active: Set the user as active. :type active: Optional(``True`` | ``False``) :param admin: Give the new user admin rights. @@ -250,6 +253,7 @@ def create_user(request, apiuser, userna email = Optional.extract(email) first_name = Optional.extract(firstname) last_name = Optional.extract(lastname) + description = Optional.extract(description) active = Optional.extract(active) admin = Optional.extract(admin) extern_type = Optional.extract(extern_type) @@ -267,6 +271,7 @@ def create_user(request, apiuser, userna last_name=last_name, active=active, admin=admin, + description=description, extern_type=extern_type, extern_name=extern_name, )) @@ -280,6 +285,7 @@ def create_user(request, apiuser, userna email=schema_data['email'], firstname=schema_data['first_name'], lastname=schema_data['last_name'], + description=schema_data['description'], active=schema_data['active'], admin=schema_data['admin'], extern_type=schema_data['extern_type'], @@ -307,7 +313,7 @@ def create_user(request, apiuser, userna def update_user(request, apiuser, userid, username=Optional(None), email=Optional(None), password=Optional(None), firstname=Optional(None), lastname=Optional(None), - active=Optional(None), admin=Optional(None), + description=Optional(None), active=Optional(None), admin=Optional(None), extern_type=Optional(None), extern_name=Optional(None), ): """ Updates the details for the specified user, if that user exists. @@ -331,6 +337,8 @@ def update_user(request, apiuser, userid :type firstname: Optional(str) :param lastname: Set the new surname. :type lastname: Optional(str) + :param description: Set user description, or short bio. Metatags are allowed. + :type description: Optional(str) :param active: Set the new user as active. :type active: Optional(``True`` | ``False``) :param admin: Give the user admin rights. @@ -379,6 +387,7 @@ def update_user(request, apiuser, userid store_update(updates, email, 'email') store_update(updates, firstname, 'name') store_update(updates, lastname, 'lastname') + store_update(updates, description, 'description') store_update(updates, active, 'active') store_update(updates, admin, 'admin') store_update(updates, extern_name, 'extern_name') diff --git a/rhodecode/apps/admin/tests/test_admin_users.py b/rhodecode/apps/admin/tests/test_admin_users.py --- a/rhodecode/apps/admin/tests/test_admin_users.py +++ b/rhodecode/apps/admin/tests/test_admin_users.py @@ -335,6 +335,7 @@ class TestAdminUsersView(TestController) response = self.app.post(route_path('users_create'), params={ 'username': username, 'password': password, + 'description': 'mr CTO', 'password_confirmation': password_confirmation, 'firstname': name, 'active': True, @@ -383,6 +384,7 @@ class TestAdminUsersView(TestController) 'name': name, 'active': False, 'lastname': lastname, + 'description': 'mr CTO', 'email': email, 'csrf_token': self.csrf_token, }) @@ -420,6 +422,7 @@ class TestAdminUsersView(TestController) ('email', {'email': 'some@email.com'}), ('language', {'language': 'de'}), ('language', {'language': 'en'}), + ('description', {'description': 'hello CTO'}), # ('new_password', {'new_password': 'foobar123', # 'password_confirmation': 'foobar123'}) ]) diff --git a/rhodecode/model/db.py b/rhodecode/model/db.py --- a/rhodecode/model/db.py +++ b/rhodecode/model/db.py @@ -1062,6 +1062,7 @@ class User(Base, BaseModel): 'username': user.username, 'firstname': user.name, 'lastname': user.lastname, + 'description': user.description, 'email': user.email, 'emails': user.emails, } diff --git a/rhodecode/model/user.py b/rhodecode/model/user.py --- a/rhodecode/model/user.py +++ b/rhodecode/model/user.py @@ -226,7 +226,7 @@ class UserModel(BaseModel): active=True, admin=False, extern_type=None, extern_name=None, cur_user=None, plugin=None, force_password_change=False, allow_to_create_user=True, create_repo_group=None, - updating_user_id=None, language=None, description=None, + updating_user_id=None, language=None, description='', strict_creation_check=True): """ Creates a new instance if not found, or updates current one @@ -251,6 +251,8 @@ class UserModel(BaseModel): :param updating_user_id: if we set it up this is the user we want to update this allows to editing username. :param language: language of user from interface. + :param description: user description + :param strict_creation_check: checks for allowed creation license wise etc. :returns: new User object with injected `is_new_user` attribute. """ diff --git a/rhodecode/model/validation_schema/schemas/user_schema.py b/rhodecode/model/validation_schema/schemas/user_schema.py --- a/rhodecode/model/validation_schema/schemas/user_schema.py +++ b/rhodecode/model/validation_schema/schemas/user_schema.py @@ -103,6 +103,9 @@ class UserSchema(colander.Schema): last_name = colander.SchemaNode( colander.String(), missing='') + description = colander.SchemaNode( + colander.String(), missing='') + active = colander.SchemaNode( types.StringBooleanType(), missing=False) diff --git a/rhodecode/templates/admin/users/user_edit_profile.mako b/rhodecode/templates/admin/users/user_edit_profile.mako --- a/rhodecode/templates/admin/users/user_edit_profile.mako +++ b/rhodecode/templates/admin/users/user_edit_profile.mako @@ -71,7 +71,13 @@
- ${h.textarea('description', class_="medium")} + ${h.textarea('description', rows=10, class_="medium")} + <% metatags_url = h.literal('''meta-tags''') %> + ${_('Plain text format with support of {metatags}. Add a README file for longer descriptions').format(metatags=metatags_url)|n} +
diff --git a/rhodecode/tests/fixture.py b/rhodecode/tests/fixture.py --- a/rhodecode/tests/fixture.py +++ b/rhodecode/tests/fixture.py @@ -231,6 +231,7 @@ class Fixture(object): 'email': '%s+test@rhodecode.org' % name, 'firstname': 'TestUser', 'lastname': 'Test', + 'description': 'test description', 'active': True, 'admin': False, 'extern_type': 'rhodecode',