// AddPolicy adds a policy rule to the storage.
AddPolicy adds a policy rule to the storage.
// AddPolicy adds a policy rule to the storage .
func (a *adapter) AddPolicy(sec string, ptype string, rule []string) error {
	line := savePolicyLine(ptype, rule)
	ctx, cancle := context.WithTimeout(context.TODO(), a.timeout)
	defer cancle()
	if _, err := a.collection.InsertOne(ctx, line); err != nil {
		return err
	}
	return nil
}
func ( a * adapter ) AddPolicy ( sec string , ptype string , rule [ ] string ) error { line := savePolicyLine ( ptype , rule ) ctx , cancle := context . WithTimeout ( context . TODO ( ) , a . timeout ) defer cancle ( ) if _ , err := a . collection . InsertOne ( ctx , line ) ; err != nil { return err } return nil }
AddPolicy adds a policy rule to the storage.
AddPolicy adds a policy rule to the storage .