equal
deleted
inserted
replaced
101 - None if the entity is allowed to resign. |
101 - None if the entity is allowed to resign. |
102 - Error message otherwise. |
102 - Error message otherwise. |
103 """ |
103 """ |
104 |
104 |
105 if self.disallow_last_resign: |
105 if self.disallow_last_resign: |
106 # check if this is the last active role for it's scope |
106 # check if this is the last active role for it's scope |
107 fields = {'scope': entity.scope, |
107 fields = {'scope': entity.scope, |
108 'status': 'active'} |
108 'status': 'active'} |
109 roles = self.getForFields(fields, limit=2) |
109 roles = self.getForFields(fields, limit=2) |
110 |
110 |
111 # if this it the last one return error message |
111 # if this it the last one return error message |
112 if len(roles) <= 1: |
112 if len(roles) <= 1: |
113 return DEF_LAST_RESIGN_ERROR_FMT |
113 return DEF_LAST_RESIGN_ERROR_FMT |
114 |
114 |
115 # resignation is possible |
115 # resignation is possible |
116 return None |
116 return None |
117 |
117 |
118 logic = Logic() |
118 logic = Logic() |