diff --git a/pkg/notify/models/receiver.go b/pkg/notify/models/receiver.go index d4378c42fc..5e8c183fb7 100644 --- a/pkg/notify/models/receiver.go +++ b/pkg/notify/models/receiver.go @@ -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) diff --git a/pkg/notify/models/subscriber_receiver.go b/pkg/notify/models/subscriber_receiver.go index ccec29b2fe..daf331edb5 100644 --- a/pkg/notify/models/subscriber_receiver.go +++ b/pkg/notify/models/subscriber_receiver.go @@ -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 { diff --git a/pkg/notify/policy/defaults.go b/pkg/notify/policy/defaults.go index f3e5bb3dfd..f08409a705 100644 --- a/pkg/notify/policy/defaults.go +++ b/pkg/notify/policy/defaults.go @@ -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, + }, + }, + }, } )