|
@@ -60,6 +60,9 @@ func RoleDelete(param protocol.RequestRoleDelete) error { |
|
@@ -60,6 +60,9 @@ func RoleDelete(param protocol.RequestRoleDelete) error { |
60
|
log.Error(e.Error())
|
60
|
log.Error(e.Error())
|
61
|
return protocol.NewErrWithMessage("1", e)
|
61
|
return protocol.NewErrWithMessage("1", e)
|
62
|
}
|
62
|
}
|
|
|
63
|
+ if ok := role.IsDefaultRole(); ok {
|
|
|
64
|
+ return protocol.NewErrWithMessage("10006")
|
|
|
65
|
+ }
|
63
|
if role.CompanyId != param.CompanyID {
|
66
|
if role.CompanyId != param.CompanyID {
|
64
|
e := fmt.Errorf("role.CompanyId(%d) != param.CompanyID(%d)", role.CompanyId, param.CompanyID)
|
67
|
e := fmt.Errorf("role.CompanyId(%d) != param.CompanyID(%d)", role.CompanyId, param.CompanyID)
|
65
|
log.Error(e.Error())
|
68
|
log.Error(e.Error())
|
|
@@ -98,6 +101,12 @@ func RoleEdit(param protocol.RequestRoleEdit) (*protocol.ResponseRoleInfo, error |
|
@@ -98,6 +101,12 @@ func RoleEdit(param protocol.RequestRoleEdit) (*protocol.ResponseRoleInfo, error |
98
|
log.Error(e.Error())
|
101
|
log.Error(e.Error())
|
99
|
return nil, protocol.NewErrWithMessage("1", e)
|
102
|
return nil, protocol.NewErrWithMessage("1", e)
|
100
|
}
|
103
|
}
|
|
|
104
|
+ if ok := role.IsDefaultRole(); ok && role.Types == models.ROLETYPES_ROLE {
|
|
|
105
|
+ return nil, protocol.NewErrWithMessage("10005")
|
|
|
106
|
+ }
|
|
|
107
|
+ if ok := role.IsDefaultRole(); ok && role.Types == models.ROLETYPES_GROUP {
|
|
|
108
|
+ return nil, protocol.NewErrWithMessage("10006")
|
|
|
109
|
+ }
|
101
|
if role.CompanyId != param.CompanyID {
|
110
|
if role.CompanyId != param.CompanyID {
|
102
|
e := fmt.Errorf("role.CompanyId(%d) != param.CompanyID(%d)", role.CompanyId, param.CompanyID)
|
111
|
e := fmt.Errorf("role.CompanyId(%d) != param.CompanyID(%d)", role.CompanyId, param.CompanyID)
|
103
|
log.Error(e.Error())
|
112
|
log.Error(e.Error())
|
|
@@ -142,6 +151,9 @@ func RoleGroupDelete(param protocol.RequestRoleDelete) error { |
|
@@ -142,6 +151,9 @@ func RoleGroupDelete(param protocol.RequestRoleDelete) error { |
142
|
log.Error(e.Error())
|
151
|
log.Error(e.Error())
|
143
|
return protocol.NewErrWithMessage("1", e)
|
152
|
return protocol.NewErrWithMessage("1", e)
|
144
|
}
|
153
|
}
|
|
|
154
|
+ if ok := roleinfo.IsDefaultRole(); ok {
|
|
|
155
|
+ return protocol.NewErrWithMessage("10005")
|
|
|
156
|
+ }
|
145
|
if roleinfo.CompanyId != param.CompanyID {
|
157
|
if roleinfo.CompanyId != param.CompanyID {
|
146
|
e := fmt.Errorf("roleinfo.CompanyId(%d) != param.CompanyID(%d)", roleinfo.CompanyId, param.CompanyID)
|
158
|
e := fmt.Errorf("roleinfo.CompanyId(%d) != param.CompanyID(%d)", roleinfo.CompanyId, param.CompanyID)
|
147
|
log.Error(e.Error())
|
159
|
log.Error(e.Error())
|