Merge pull request #12368 from rainzm/notify/fix

Fixes for Notify Subscribers
This commit is contained in:
Zexi Li
2021-10-09 09:15:20 +08:00
committed by GitHub
3 changed files with 44 additions and 2 deletions
+1 -1
View File
@@ -905,7 +905,6 @@ func (r *SReceiver) PreUpdate(ctx context.Context, userCred mcclient.TokenCreden
mobile := input.InternationalMobile.String()
if len(mobile) != 0 && mobile != r.Mobile {
r.VerifiedMobile = tristate.False
r.Mobile = mobile
for _, c := range r.subContactCache {
if c.ParentContactType == api.MOBILE {
c.Verified = tristate.False
@@ -935,6 +934,7 @@ func (r *SReceiver) PreUpdate(ctx context.Context, userCred mcclient.TokenCreden
r.VerifiedMobile = tristate.True
}
}
r.Mobile = mobile
err = ReceiverManager.TableSpec().InsertOrUpdate(ctx, r)
if err != nil {
log.Errorf("InsertOrUpdate: %v", err)
+1 -1
View File
@@ -43,7 +43,7 @@ type SSubscriberReceiverManager struct {
type SSubscriberReceiver struct {
db.SJointResourceBase
SubscriberId string `width:"36" charset:"ascii" nullable:"false" index:"true"`
ReceiverId string `width:"36" charset:"ascii" nullable:"false" index:"true"`
ReceiverId string `width:"128" charset:"ascii" nullable:"false" index:"true"`
}
func (srm *SSubscriberReceiverManager) GetMasterFieldName() string {
+42
View File
@@ -133,6 +133,48 @@ var (
},
},
},
{
Auth: true,
Scope: rbacutils.ScopeDomain,
Rules: []rbacutils.SRbacRule{
{
Service: api.SERVICE_TYPE,
Resource: "subscribers",
Action: PolicyActionGet,
Result: rbacutils.Allow,
},
{
Service: api.SERVICE_TYPE,
Resource: "subscribers",
Action: PolicyActionList,
Result: rbacutils.Allow,
},
{
Service: api.SERVICE_TYPE,
Resource: "subscribers",
Action: PolicyActionCreate,
Result: rbacutils.Allow,
},
{
Service: api.SERVICE_TYPE,
Resource: "subscribers",
Action: PolicyActionUpdate,
Result: rbacutils.Allow,
},
{
Service: api.SERVICE_TYPE,
Resource: "subscribers",
Action: PolicyActionDelete,
Result: rbacutils.Allow,
},
{
Service: api.SERVICE_TYPE,
Resource: "subscribers",
Action: PolicyActionPerform,
Result: rbacutils.Allow,
},
},
},
}
)