Commit cc9554cd authored by jym503558564's avatar jym503558564

[Update] 修改用户详情页中添加用户组标签的显示条件是:当前组织的普通用户或组管理员

parent 54887a34
...@@ -118,6 +118,11 @@ class Organization(models.Model): ...@@ -118,6 +118,11 @@ class Organization(models.Model):
return True return True
return False return False
def can_user_by(self, user):
if self.get_org_users().filter(id=user.id):
return True
return False
def is_real(self): def is_real(self):
return self.id not in (self.DEFAULT_NAME, self.ROOT_ID, self.SYSTEM_ID) return self.id not in (self.DEFAULT_NAME, self.ROOT_ID, self.SYSTEM_ID)
......
...@@ -217,6 +217,10 @@ class RoleMixin: ...@@ -217,6 +217,10 @@ class RoleMixin:
def can_audit_current_org(self): def can_audit_current_org(self):
return current_org.can_audit_by(self) return current_org.can_audit_by(self)
@property
def can_user_current_org(self):
return current_org.can_user_by(self)
@property @property
def can_admin_or_audit_current_org(self): def can_admin_or_audit_current_org(self):
return self.can_admin_current_org or self.can_audit_current_org return self.can_admin_current_org or self.can_audit_current_org
......
...@@ -211,8 +211,8 @@ ...@@ -211,8 +211,8 @@
</table> </table>
</div> </div>
</div> </div>
{% if request.user.can_admin_current_org %}
{% if request.user.can_admin_current_org and not user_object.can_audit_current_org%} {% if user_object.can_user_current_org or user_object.can_admin_current_org %}
<div class="panel panel-info"> <div class="panel panel-info">
<div class="panel-heading"> <div class="panel-heading">
<i class="fa fa-info-circle"></i> {% trans 'User group' %} <i class="fa fa-info-circle"></i> {% trans 'User group' %}
...@@ -252,6 +252,7 @@ ...@@ -252,6 +252,7 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% endif %}
</div> </div>
</div> </div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment