Browse Source

add is_active to role/workspace_member

Guénaël Muller 6 years ago
parent
commit
79239ba09d

+ 4 - 0
tracim/models/context_models.py View File

299
         return WorkspaceRoles.get_role_from_level(self.user_role.role).slug
299
         return WorkspaceRoles.get_role_from_level(self.user_role.role).slug
300
 
300
 
301
     @property
301
     @property
302
+    def is_active(self) -> bool:
303
+        return self.user.is_active
304
+
305
+    @property
302
     def user(self) -> UserInContext:
306
     def user(self) -> UserInContext:
303
         """
307
         """
304
         User who has this role, with context data
308
         User who has this role, with context data

+ 1 - 0
tracim/tests/functional/test_workspaces.py View File

164
         assert user_role['workspace']['slug'] == 'business'
164
         assert user_role['workspace']['slug'] == 'business'
165
         assert user_role['user']['public_name'] == 'Global manager'
165
         assert user_role['user']['public_name'] == 'Global manager'
166
         assert user_role['user']['user_id'] == 1
166
         assert user_role['user']['user_id'] == 1
167
+        assert user_role['is_active'] is True
167
         # TODO - G.M - 24-05-2018 - [Avatar] Replace
168
         # TODO - G.M - 24-05-2018 - [Avatar] Replace
168
         # by correct value when avatar feature will be enabled
169
         # by correct value when avatar feature will be enabled
169
         assert user_role['user']['avatar_url'] is None
170
         assert user_role['user']['avatar_url'] is None

+ 1 - 0
tracim/views/core_api/schemas.py View File

236
     workspace = marshmallow.fields.Nested(
236
     workspace = marshmallow.fields.Nested(
237
         WorkspaceDigestSchema(exclude=('sidebar_entries',))
237
         WorkspaceDigestSchema(exclude=('sidebar_entries',))
238
     )
238
     )
239
+    is_active = marshmallow.fields.Bool()
239
 
240
 
240
     class Meta:
241
     class Meta:
241
         description = 'Workspace Member information'
242
         description = 'Workspace Member information'