Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread heiheshang
DEBUG: mysite:34 
 
{acl_mqtt,direct,<<"site/mysite/flight">>,[<<"site">>,<<"mysite">>,<<"flight">>],<<"mysite">>,<<"uRBtcIBLWCKpWoslTfiR">>}


I see it in the console, what does it mean?

четверг, 1 декабря 2016 г., 1:36:51 UTC+9 пользователь Marc Worrell написал:
>
> Just to be sure, it is a module as in “mod_something.erl” ?
> And other observers in that module are called?
>
> - Marc
>
>
>
> On 30 Nov 2016, at 17:30, heiheshang > 
> wrote:
>
> subscription works only in one module, other modules in the code is not 
> running. The priority of the module is 10.
> in other modules? DEBUG does not work, do not understand why is not 
> called -export([observe_acl_is_allowed/2]).
>
> четверг, 1 декабря 2016 г., 1:18:32 UTC+9 пользователь Marc Worrell 
> написал:
>>
>> The function is exported?
>>
>> Maybe make the priority of you module a bit higher.
>> Set it to 10 or so.
>>
>> -mod_prio(10).
>>
>> - Marc
>>
>> On 30 Nov 2016, at 17:14, heiheshang  wrote:
>>
>> observe_acl_is_allowed(X,Context) ->
>> ?DEBUG(X);
>>
>>
>> He added, but there is no output
>>
>> четверг, 1 декабря 2016 г., 0:59:01 UTC+9 пользователь Marc Worrell 
>> написал:
>>>
>>>
>>> On 30 Nov 2016, at 16:52, heiheshang  wrote:
>>>
>>> observe_acl_is_allowed(#acl_is_allowed{action=publish,
>>> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
>>> Context) ->
>>> true;
>>> observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
>>> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
>>> Context) ->
>>> true;
>>> observe_acl_is_allowed(#acl_is_allowed{}, _Context) ->
>>> undefined.
>>>
>>> z_mqtt:publish(<<"~site/flight">>,[],Context),
>>> I try different options, but it still does not work, an ordinary user 
>>> can not send messages only to the administrator.
>>>
>>>
>>> Maybe add a ?DEBUG() of the arguments in the last clause of 
>>> observer_acl_is_allowed.
>>>
>>> Here is an example:
>>>
>>> https://github.com/mworrell/mod_chitchat/blob/master/mod_chitchat.erl#L90
>>>
>>> - Marc
>>>
>>>
>> -- 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Zotonic developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to zotonic-developers+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
> -- 
>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Zotonic developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to zotonic-developers+unsubscr...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread heiheshang
modul called without mod_,does it matter?
 

четверг, 1 декабря 2016 г., 1:36:51 UTC+9 пользователь Marc Worrell написал:
>
> Just to be sure, it is a module as in “mod_something.erl” ?
> And other observers in that module are called?
>
> - Marc
>
>
>
> On 30 Nov 2016, at 17:30, heiheshang > 
> wrote:
>
> subscription works only in one module, other modules in the code is not 
> running. The priority of the module is 10.
> in other modules? DEBUG does not work, do not understand why is not 
> called -export([observe_acl_is_allowed/2]).
>
> четверг, 1 декабря 2016 г., 1:18:32 UTC+9 пользователь Marc Worrell 
> написал:
>>
>> The function is exported?
>>
>> Maybe make the priority of you module a bit higher.
>> Set it to 10 or so.
>>
>> -mod_prio(10).
>>
>> - Marc
>>
>> On 30 Nov 2016, at 17:14, heiheshang  wrote:
>>
>> observe_acl_is_allowed(X,Context) ->
>> ?DEBUG(X);
>>
>>
>> He added, but there is no output
>>
>> четверг, 1 декабря 2016 г., 0:59:01 UTC+9 пользователь Marc Worrell 
>> написал:
>>>
>>>
>>> On 30 Nov 2016, at 16:52, heiheshang  wrote:
>>>
>>> observe_acl_is_allowed(#acl_is_allowed{action=publish,
>>> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
>>> Context) ->
>>> true;
>>> observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
>>> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
>>> Context) ->
>>> true;
>>> observe_acl_is_allowed(#acl_is_allowed{}, _Context) ->
>>> undefined.
>>>
>>> z_mqtt:publish(<<"~site/flight">>,[],Context),
>>> I try different options, but it still does not work, an ordinary user 
>>> can not send messages only to the administrator.
>>>
>>>
>>> Maybe add a ?DEBUG() of the arguments in the last clause of 
>>> observer_acl_is_allowed.
>>>
>>> Here is an example:
>>>
>>> https://github.com/mworrell/mod_chitchat/blob/master/mod_chitchat.erl#L90
>>>
>>> - Marc
>>>
>>>
>> -- 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Zotonic developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to zotonic-developers+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
> -- 
>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Zotonic developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to zotonic-developers+unsubscr...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread heiheshang
Yes
-export([observe_acl_is_allowed/2]).
and mod_prio(10)
but another module mod_prio(600) and all work
четверг, 1 декабря 2016 г., 1:18:32 UTC+9 пользователь Marc Worrell написал:
>
> The function is exported?
>
> Maybe make the priority of you module a bit higher.
> Set it to 10 or so.
>
> -mod_prio(10).
>
> - Marc
>
> On 30 Nov 2016, at 17:14, heiheshang > 
> wrote:
>
> observe_acl_is_allowed(X,Context) ->
> ?DEBUG(X);
>
>
> He added, but there is no output
>
> четверг, 1 декабря 2016 г., 0:59:01 UTC+9 пользователь Marc Worrell 
> написал:
>>
>>
>> On 30 Nov 2016, at 16:52, heiheshang  wrote:
>>
>> observe_acl_is_allowed(#acl_is_allowed{action=publish,
>> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
>> Context) ->
>> true;
>> observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
>> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
>> Context) ->
>> true;
>> observe_acl_is_allowed(#acl_is_allowed{}, _Context) ->
>> undefined.
>>
>> z_mqtt:publish(<<"~site/flight">>,[],Context),
>> I try different options, but it still does not work, an ordinary user can 
>> not send messages only to the administrator.
>>
>>
>> Maybe add a ?DEBUG() of the arguments in the last clause of 
>> observer_acl_is_allowed.
>>
>> Here is an example:
>>
>> https://github.com/mworrell/mod_chitchat/blob/master/mod_chitchat.erl#L90
>>
>> - Marc
>>
>>
> -- 
>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Zotonic developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to zotonic-developers+unsubscr...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread Marc Worrell
Just to be sure, it is a module as in “mod_something.erl” ?
And other observers in that module are called?

- Marc



> On 30 Nov 2016, at 17:30, heiheshang  wrote:
> 
> subscription works only in one module, other modules in the code is not 
> running. The priority of the module is 10.
> in other modules? DEBUG does not work, do not understand why is not called 
> -export([observe_acl_is_allowed/2]).
> 
> четверг, 1 декабря 2016 г., 1:18:32 UTC+9 пользователь Marc Worrell написал:
> The function is exported?
> 
> Maybe make the priority of you module a bit higher.
> Set it to 10 or so.
> 
>   -mod_prio(10).
> 
> - Marc
> 
>> On 30 Nov 2016, at 17:14, heiheshang > 
>> wrote:
>> 
>> observe_acl_is_allowed(X,Context) ->
>> ?DEBUG(X);
>> 
>> 
>> He added, but there is no output
>> 
>> четверг, 1 декабря 2016 г., 0:59:01 UTC+9 пользователь Marc Worrell написал:
>> 
>>> On 30 Nov 2016, at 16:52, heiheshang > wrote:
>>> 
>>> observe_acl_is_allowed(#acl_is_allowed{action=publish,
>>> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
>>> Context) ->
>>> true;
>>> observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
>>> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
>>> Context) ->
>>> true;
>>> observe_acl_is_allowed(#acl_is_allowed{}, _Context) ->
>>> undefined.
>>> 
>>> z_mqtt:publish(<<"~site/flight">>,[],Context),
>>> I try different options, but it still does not work, an ordinary user can 
>>> not send messages only to the administrator.
>> 
>> Maybe add a ?DEBUG() of the arguments in the last clause of 
>> observer_acl_is_allowed.
>> 
>> Here is an example:
>> 
>> https://github.com/mworrell/mod_chitchat/blob/master/mod_chitchat.erl#L90 
>> 
>> 
>> - Marc
>> 
>> 
>> -- 
>> 
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Zotonic developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to zotonic-developers+unsubscr...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout 
>> .
> 
> 
> -- 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Zotonic developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to zotonic-developers+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread heiheshang
subscription works only in one module, other modules in the code is not 
running. The priority of the module is 10.
in other modules? DEBUG does not work, do not understand why is not 
called -export([observe_acl_is_allowed/2]).

четверг, 1 декабря 2016 г., 1:18:32 UTC+9 пользователь Marc Worrell написал:
>
> The function is exported?
>
> Maybe make the priority of you module a bit higher.
> Set it to 10 or so.
>
> -mod_prio(10).
>
> - Marc
>
> On 30 Nov 2016, at 17:14, heiheshang > 
> wrote:
>
> observe_acl_is_allowed(X,Context) ->
> ?DEBUG(X);
>
>
> He added, but there is no output
>
> четверг, 1 декабря 2016 г., 0:59:01 UTC+9 пользователь Marc Worrell 
> написал:
>>
>>
>> On 30 Nov 2016, at 16:52, heiheshang  wrote:
>>
>> observe_acl_is_allowed(#acl_is_allowed{action=publish,
>> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
>> Context) ->
>> true;
>> observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
>> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
>> Context) ->
>> true;
>> observe_acl_is_allowed(#acl_is_allowed{}, _Context) ->
>> undefined.
>>
>> z_mqtt:publish(<<"~site/flight">>,[],Context),
>> I try different options, but it still does not work, an ordinary user can 
>> not send messages only to the administrator.
>>
>>
>> Maybe add a ?DEBUG() of the arguments in the last clause of 
>> observer_acl_is_allowed.
>>
>> Here is an example:
>>
>> https://github.com/mworrell/mod_chitchat/blob/master/mod_chitchat.erl#L90
>>
>> - Marc
>>
>>
> -- 
>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Zotonic developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to zotonic-developers+unsubscr...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread Marc Worrell
The function is exported?

Maybe make the priority of you module a bit higher.
Set it to 10 or so.

-mod_prio(10).

- Marc

> On 30 Nov 2016, at 17:14, heiheshang  wrote:
> 
> observe_acl_is_allowed(X,Context) ->
> ?DEBUG(X);
> 
> 
> He added, but there is no output
> 
> четверг, 1 декабря 2016 г., 0:59:01 UTC+9 пользователь Marc Worrell написал:
> 
>> On 30 Nov 2016, at 16:52, heiheshang > 
>> wrote:
>> 
>> observe_acl_is_allowed(#acl_is_allowed{action=publish,
>> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, Context) 
>> ->
>> true;
>> observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
>> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, Context) 
>> ->
>> true;
>> observe_acl_is_allowed(#acl_is_allowed{}, _Context) ->
>> undefined.
>> 
>> z_mqtt:publish(<<"~site/flight">>,[],Context),
>> I try different options, but it still does not work, an ordinary user can 
>> not send messages only to the administrator.
> 
> Maybe add a ?DEBUG() of the arguments in the last clause of 
> observer_acl_is_allowed.
> 
> Here is an example:
> 
> https://github.com/mworrell/mod_chitchat/blob/master/mod_chitchat.erl#L90 
> 
> 
> - Marc
> 
> 
> -- 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Zotonic developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to zotonic-developers+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread heiheshang
observe_acl_is_allowed(X,Context) ->
?DEBUG(X);


He added, but there is no output

четверг, 1 декабря 2016 г., 0:59:01 UTC+9 пользователь Marc Worrell написал:
>
>
> On 30 Nov 2016, at 16:52, heiheshang > 
> wrote:
>
> observe_acl_is_allowed(#acl_is_allowed{action=publish,
> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
> Context) ->
> true;
> observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
> Context) ->
> true;
> observe_acl_is_allowed(#acl_is_allowed{}, _Context) ->
> undefined.
>
> z_mqtt:publish(<<"~site/flight">>,[],Context),
> I try different options, but it still does not work, an ordinary user can 
> not send messages only to the administrator.
>
>
> Maybe add a ?DEBUG() of the arguments in the last clause of 
> observer_acl_is_allowed.
>
> Here is an example:
>
> https://github.com/mworrell/mod_chitchat/blob/master/mod_chitchat.erl#L90
>
> - Marc
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread Marc Worrell

> On 30 Nov 2016, at 16:52, heiheshang  wrote:
> 
> observe_acl_is_allowed(#acl_is_allowed{action=publish,
> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, Context) 
> ->
> true;
> observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
> object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, Context) 
> ->
> true;
> observe_acl_is_allowed(#acl_is_allowed{}, _Context) ->
> undefined.
> 
> z_mqtt:publish(<<"~site/flight">>,[],Context),
> I try different options, but it still does not work, an ordinary user can not 
> send messages only to the administrator.

Maybe add a ?DEBUG() of the arguments in the last clause of 
observer_acl_is_allowed.

Here is an example:

https://github.com/mworrell/mod_chitchat/blob/master/mod_chitchat.erl#L90 


- Marc

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread heiheshang
observe_acl_is_allowed(#acl_is_allowed{action=publish,
object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
Context) ->
true;
observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
object=#acl_mqtt{words=[<<"~site">>,<<"flight">>| _Rest]}}, 
Context) ->
true;
observe_acl_is_allowed(#acl_is_allowed{}, _Context) ->
undefined.

z_mqtt:publish(<<"~site/flight">>,[],Context),
I try different options, but it still does not work, an ordinary user can 
not send messages only to the administrator.


четверг, 1 декабря 2016 г., 0:21:54 UTC+9 пользователь Marc Worrell написал:
>
>
> On 30 Nov 2016, at 16:10, heiheshang > 
> wrote:
>
> yet this only works for the administrator, all other users do not receive 
> messages
>
>
> Probably due to the <<“~site”>> in your pattern.
>
> Administrators have a shortcut in all ACL checks, so that they can do 
> anything regardless of ACL modules.
> So for administrators this code is never reached.
>
> For normal users this code is reached and then the topic-words might not 
> match with the pattern.
> Trace this observer if you want to see all patterns.
>
> - Marc
>
>
>
> среда, 30 ноября 2016 г., 23:37:13 UTC+9 пользователь Marc Worrell написал:
>>
>> Check the “words” that pass here, shorthands like “~site” will already be 
>> expanded here.
>>
>> In your case you can match on: [<<“site”>>, _Site, <<“flight”>> | _]
>>
>> But returning true here will indeed allow any user to publish or 
>> subscribe to these topics.
>>
>> - Marc
>>
>>
>>
>> On 30 Nov 2016, at 15:30, heiheshang  wrote:
>>
>> observe_acl_is_allowed(#acl_is_allowed{action=publish,
>> object=#acl_mqtt{words=[<<"~site">>, <<"flight">>| _Rest]}}, 
>> Context) ->
>> true;
>> observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
>> object=#acl_mqtt{words=[<<"~site">>, <<"flight">>| _Rest]}}, 
>> Context) ->
>> true;
>>
>> as well give right?
>>
>>
>> суббота, 26 ноября 2016 г., 17:08:44 UTC+9 пользователь heiheshang 
>> написал:
>>>
>>> Yes I can change the context, but not anyone can get this message, only 
>>> now the administrator can
>>>
>>> суббота, 26 ноября 2016 г., 16:35:59 UTC+9 пользователь Marc Worrell 
>>> написал:

 Quick reply, as I am away from my keyboard.

 MQTT messages are ACL checked by topic. You can check mod_mqtt for an 
 example observer.

 If you just want to publish from Erlang, then you can use z_acl:sudo/1 
 on the Context. This switches off ACL checks.

 - Marc

 Sent from my iPhone

 On 26 Nov 2016, at 03:49, heiheshang  wrote:

 how to set the right user to send messages to z_mqtt.
 I found that the average user of this site can not send messages

 -- 

 --- 
 You received this message because you are subscribed to the Google 
 Groups "Zotonic developers" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to zotonic-developers+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


>> -- 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Zotonic developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to zotonic-developers+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
> -- 
>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Zotonic developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to zotonic-developers+unsubscr...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread Marc Worrell

> On 30 Nov 2016, at 16:10, heiheshang  wrote:
> 
> yet this only works for the administrator, all other users do not receive 
> messages

Probably due to the <<“~site”>> in your pattern.

Administrators have a shortcut in all ACL checks, so that they can do anything 
regardless of ACL modules.
So for administrators this code is never reached.

For normal users this code is reached and then the topic-words might not match 
with the pattern.
Trace this observer if you want to see all patterns.

- Marc


> 
> среда, 30 ноября 2016 г., 23:37:13 UTC+9 пользователь Marc Worrell написал:
> Check the “words” that pass here, shorthands like “~site” will already be 
> expanded here.
> 
> In your case you can match on: [<<“site”>>, _Site, <<“flight”>> | _]
> 
> But returning true here will indeed allow any user to publish or subscribe to 
> these topics.
> 
> - Marc
> 
> 
> 
>> On 30 Nov 2016, at 15:30, heiheshang > 
>> wrote:
>> 
>> observe_acl_is_allowed(#acl_is_allowed{action=publish,
>> object=#acl_mqtt{words=[<<"~site">>, <<"flight">>| _Rest]}}, 
>> Context) ->
>> true;
>> observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
>> object=#acl_mqtt{words=[<<"~site">>, <<"flight">>| _Rest]}}, 
>> Context) ->
>> true;
>> 
>> as well give right?
>> 
>> 
>> суббота, 26 ноября 2016 г., 17:08:44 UTC+9 пользователь heiheshang написал:
>> Yes I can change the context, but not anyone can get this message, only now 
>> the administrator can
>> 
>> суббота, 26 ноября 2016 г., 16:35:59 UTC+9 пользователь Marc Worrell написал:
>> Quick reply, as I am away from my keyboard.
>> 
>> MQTT messages are ACL checked by topic. You can check mod_mqtt for an 
>> example observer.
>> 
>> If you just want to publish from Erlang, then you can use z_acl:sudo/1 on 
>> the Context. This switches off ACL checks.
>> 
>> - Marc
>> 
>> Sent from my iPhone
>> 
>> On 26 Nov 2016, at 03:49, heiheshang > wrote:
>> 
>>> how to set the right user to send messages to z_mqtt.
>>> I found that the average user of this site can not send messages
>>> 
>>> -- 
>>> 
>>> --- 
>>> You received this message because you are subscribed to the Google Groups 
>>> "Zotonic developers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an 
>>> email to zotonic-developers+unsubscr...@googlegroups.com <>.
>>> For more options, visit https://groups.google.com/d/optout 
>>> .
>> 
>> 
>> -- 
>> 
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Zotonic developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to zotonic-developers+unsubscr...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout 
>> .
> 
> 
> -- 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Zotonic developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to zotonic-developers+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread heiheshang
yet this only works for the administrator, all other users do not receive 
messages

среда, 30 ноября 2016 г., 23:37:13 UTC+9 пользователь Marc Worrell написал:
>
> Check the “words” that pass here, shorthands like “~site” will already be 
> expanded here.
>
> In your case you can match on: [<<“site”>>, _Site, <<“flight”>> | _]
>
> But returning true here will indeed allow any user to publish or subscribe 
> to these topics.
>
> - Marc
>
>
>
> On 30 Nov 2016, at 15:30, heiheshang > 
> wrote:
>
> observe_acl_is_allowed(#acl_is_allowed{action=publish,
> object=#acl_mqtt{words=[<<"~site">>, <<"flight">>| _Rest]}}, 
> Context) ->
> true;
> observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
> object=#acl_mqtt{words=[<<"~site">>, <<"flight">>| _Rest]}}, 
> Context) ->
> true;
>
> as well give right?
>
>
> суббота, 26 ноября 2016 г., 17:08:44 UTC+9 пользователь heiheshang написал:
>>
>> Yes I can change the context, but not anyone can get this message, only 
>> now the administrator can
>>
>> суббота, 26 ноября 2016 г., 16:35:59 UTC+9 пользователь Marc Worrell 
>> написал:
>>>
>>> Quick reply, as I am away from my keyboard.
>>>
>>> MQTT messages are ACL checked by topic. You can check mod_mqtt for an 
>>> example observer.
>>>
>>> If you just want to publish from Erlang, then you can use z_acl:sudo/1 
>>> on the Context. This switches off ACL checks.
>>>
>>> - Marc
>>>
>>> Sent from my iPhone
>>>
>>> On 26 Nov 2016, at 03:49, heiheshang  wrote:
>>>
>>> how to set the right user to send messages to z_mqtt.
>>> I found that the average user of this site can not send messages
>>>
>>> -- 
>>>
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Zotonic developers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to zotonic-developers+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
> -- 
>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Zotonic developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to zotonic-developers+unsubscr...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread Marc Worrell
Check the “words” that pass here, shorthands like “~site” will already be 
expanded here.

In your case you can match on: [<<“site”>>, _Site, <<“flight”>> | _]

But returning true here will indeed allow any user to publish or subscribe to 
these topics.

- Marc



> On 30 Nov 2016, at 15:30, heiheshang  wrote:
> 
> observe_acl_is_allowed(#acl_is_allowed{action=publish,
> object=#acl_mqtt{words=[<<"~site">>, <<"flight">>| _Rest]}}, Context) 
> ->
> true;
> observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
> object=#acl_mqtt{words=[<<"~site">>, <<"flight">>| _Rest]}}, Context) 
> ->
> true;
> 
> as well give right?
> 
> 
> суббота, 26 ноября 2016 г., 17:08:44 UTC+9 пользователь heiheshang написал:
> Yes I can change the context, but not anyone can get this message, only now 
> the administrator can
> 
> суббота, 26 ноября 2016 г., 16:35:59 UTC+9 пользователь Marc Worrell написал:
> Quick reply, as I am away from my keyboard.
> 
> MQTT messages are ACL checked by topic. You can check mod_mqtt for an example 
> observer.
> 
> If you just want to publish from Erlang, then you can use z_acl:sudo/1 on the 
> Context. This switches off ACL checks.
> 
> - Marc
> 
> Sent from my iPhone
> 
> On 26 Nov 2016, at 03:49, heiheshang > wrote:
> 
>> how to set the right user to send messages to z_mqtt.
>> I found that the average user of this site can not send messages
>> 
>> -- 
>> 
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Zotonic developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to zotonic-developers+unsubscr...@googlegroups.com <>.
>> For more options, visit https://groups.google.com/d/optout 
>> .
> 
> 
> -- 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Zotonic developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to zotonic-developers+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-30 Thread heiheshang
observe_acl_is_allowed(#acl_is_allowed{action=publish,
object=#acl_mqtt{words=[<<"~site">>, <<"flight">>| _Rest]}}, 
Context) ->
true;
observe_acl_is_allowed(#acl_is_allowed{action=subscribe,
object=#acl_mqtt{words=[<<"~site">>, <<"flight">>| _Rest]}}, 
Context) ->
true;

as well give right?


суббота, 26 ноября 2016 г., 17:08:44 UTC+9 пользователь heiheshang написал:
>
> Yes I can change the context, but not anyone can get this message, only 
> now the administrator can
>
> суббота, 26 ноября 2016 г., 16:35:59 UTC+9 пользователь Marc Worrell 
> написал:
>>
>> Quick reply, as I am away from my keyboard.
>>
>> MQTT messages are ACL checked by topic. You can check mod_mqtt for an 
>> example observer.
>>
>> If you just want to publish from Erlang, then you can use z_acl:sudo/1 on 
>> the Context. This switches off ACL checks.
>>
>> - Marc
>>
>> Sent from my iPhone
>>
>> On 26 Nov 2016, at 03:49, heiheshang  wrote:
>>
>> how to set the right user to send messages to z_mqtt.
>> I found that the average user of this site can not send messages
>>
>> -- 
>>
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Zotonic developers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to zotonic-developers+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-26 Thread heiheshang
Yes I can change the context, but not anyone can get this message, only now 
the administrator can

суббота, 26 ноября 2016 г., 16:35:59 UTC+9 пользователь Marc Worrell 
написал:
>
> Quick reply, as I am away from my keyboard.
>
> MQTT messages are ACL checked by topic. You can check mod_mqtt for an 
> example observer.
>
> If you just want to publish from Erlang, then you can use z_acl:sudo/1 on 
> the Context. This switches off ACL checks.
>
> - Marc
>
> Sent from my iPhone
>
> On 26 Nov 2016, at 03:49, heiheshang > 
> wrote:
>
> how to set the right user to send messages to z_mqtt.
> I found that the average user of this site can not send messages
>
> -- 
>
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Zotonic developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to zotonic-developers+unsubscr...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Zotonic-Dev] how to set the right user to send messages ?

2016-11-25 Thread Marc Worrell
Quick reply, as I am away from my keyboard.

MQTT messages are ACL checked by topic. You can check mod_mqtt for an example 
observer.

If you just want to publish from Erlang, then you can use z_acl:sudo/1 on the 
Context. This switches off ACL checks.

- Marc

Sent from my iPhone

> On 26 Nov 2016, at 03:49, heiheshang  wrote:
> 
> how to set the right user to send messages to z_mqtt.
> I found that the average user of this site can not send messages
> -- 
> 
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Zotonic developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to zotonic-developers+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[Zotonic-Dev] how to set the right user to send messages ?

2016-11-25 Thread heiheshang
how to set the right user to send messages to z_mqtt.
I found that the average user of this site can not send messages

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Zotonic developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to zotonic-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.