Re: [Trac] Re: How to get all the menus of a user through program?

2020-01-17 Thread Ryan Ollos
On Fri, Jan 17, 2020 at 2:18 AM Velu Narasimman 
wrote:

> I want to achieve this without making a HTTP request from browser. I guess
> the chrome.get_navigation_items will work only if there is a web request.
> Isn't it? Otherwise, I wish to make it without authenticating/bypassing
> authentication and everything within a python script file. Is this
> possible? Please share me your ideas.
>

Yes, you can use from Python. The samples shown are part of the Trac API.
You'll need to Mock out the Request object.

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/CA%2BBGpn9OqFziTusTE0_LaVUxc1VRbb1k6e3_XF6yQKxOa9P8uQ%40mail.gmail.com.


[Trac] Re: How to get all the menus of a user through program?

2020-01-17 Thread Velu Narasimman
I want to achieve this without making a HTTP request from browser. I guess 
the chrome.get_navigation_items will work only if there is a web request. 
Isn't it? Otherwise, I wish to make it without authenticating/bypassing 
authentication and everything within a python script file. Is this 
possible? Please share me your ideas.

On Friday, January 17, 2020 at 12:59:21 AM UTC+5:30, RjOllos wrote:
>
>
>
> On Wednesday, January 15, 2020 at 10:34:32 PM UTC-8, Velu Narasimman wrote:
>>
>> Well, I am getting menu as a dictionary as shown below,
>>
>> {'mainnav': [{'active': False, 'name': 'project', 'label': > >}, {'active': False, 'name': 'added_common', 'label': }, {
>> 'active': False, 'name': 'admin', 'label': }, {'active': 
>> False, 'name': 'reports', 'label': }, {'active': False, 
>> 'name': 'metrics', 'label': }, {'active': False, 'name': 
>> 'mytimesheet', 'label': }, {'active': True, 'name': 
>> 'myprojects', 'label': }, {'active': False, 'name': 
>> 'timesheetapproval', 'label': }], 'metanav': [{'active': 
>> False, 'name': 'login', 'label': u'logged in as karthikeyan.nagaraja'}, {
>> 'active': False, 'name': 'logout', 'label': }, {'active': 
>> False, 'name': 'prefs', 'label': }, {'active': False, 'name'
>> : 'about', 'label': }]}
>>
>> I get this, when I refresh the web page in my browser. These menus are 
>> dynamic, differs among different users based on the permissions that they 
>> have in system. But I wish to generate this without using a browser. So how 
>> can I make a web request handling in program itself and the above menus?
>>
>
> Are you calling Chrome.get_navigation_items?
> https://trac.edgewall.org/browser/tags/trac-1.4/trac/web/chrome.py#L862 
> 
>
> You'll need to make a MockRequest. For examples, I believe this is done in 
> a few plugins, but I don't recall which off-hand.
>
> I suppose you could use MockRequest from the test module:
> https://trac.edgewall.org/browser/tags/trac-1.4/trac/test.py#L151
>
> - Ryan
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/1adbf833-e133-4f07-a2a6-961a57a43fe2%40googlegroups.com.


[Trac] Re: How to get all the menus of a user through program?

2020-01-16 Thread RjOllos


On Thursday, January 16, 2020 at 11:29:21 AM UTC-8, RjOllos wrote:
>
>
>
> On Wednesday, January 15, 2020 at 10:34:32 PM UTC-8, Velu Narasimman wrote:
>>
>> Well, I am getting menu as a dictionary as shown below,
>>
>> {'mainnav': [{'active': False, 'name': 'project', 'label': > >}, {'active': False, 'name': 'added_common', 'label': }, {
>> 'active': False, 'name': 'admin', 'label': }, {'active': 
>> False, 'name': 'reports', 'label': }, {'active': False, 
>> 'name': 'metrics', 'label': }, {'active': False, 'name': 
>> 'mytimesheet', 'label': }, {'active': True, 'name': 
>> 'myprojects', 'label': }, {'active': False, 'name': 
>> 'timesheetapproval', 'label': }], 'metanav': [{'active': 
>> False, 'name': 'login', 'label': u'logged in as karthikeyan.nagaraja'}, {
>> 'active': False, 'name': 'logout', 'label': }, {'active': 
>> False, 'name': 'prefs', 'label': }, {'active': False, 'name'
>> : 'about', 'label': }]}
>>
>> I get this, when I refresh the web page in my browser. These menus are 
>> dynamic, differs among different users based on the permissions that they 
>> have in system. But I wish to generate this without using a browser. So how 
>> can I make a web request handling in program itself and the above menus?
>>
>
> Are you calling Chrome.get_navigation_items?
> https://trac.edgewall.org/browser/tags/trac-1.4/trac/web/chrome.py#L862
>
> You'll need to make a MockRequest. For examples, I believe this is done in 
> a few plugins, but I don't recall which off-hand.
>
> I suppose you could use MockRequest from the test module:
> https://trac.edgewall.org/browser/tags/trac-1.4/trac/test.py#L151
>
> - Ryan
>

Or better might be to extract and modify this code to meet your needs:
https://trac.edgewall.org/browser/tags/trac-1.4/trac/web/chrome.py?marks=947-952#L947

With regard to the mock Request object, navigation contributors only check 
permissions like "PERM in req.perm", so your mock could just return True 
for that case.

- Ryan 

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/c29954d8-ce06-4de5-bc52-0c5503b6beb7%40googlegroups.com.


[Trac] Re: How to get all the menus of a user through program?

2020-01-16 Thread RjOllos


On Wednesday, January 15, 2020 at 10:34:32 PM UTC-8, Velu Narasimman wrote:
>
> Well, I am getting menu as a dictionary as shown below,
>
> {'mainnav': [{'active': False, 'name': 'project', 'label': }, 
> {'active': False, 'name': 'added_common', 'label': }, {
> 'active': False, 'name': 'admin', 'label': }, {'active': 
> False, 'name': 'reports', 'label': }, {'active': False, 
> 'name': 'metrics', 'label': }, {'active': False, 'name': 
> 'mytimesheet', 'label': }, {'active': True, 'name': 
> 'myprojects', 'label': }, {'active': False, 'name': 
> 'timesheetapproval', 'label': }], 'metanav': [{'active': 
> False, 'name': 'login', 'label': u'logged in as karthikeyan.nagaraja'}, {
> 'active': False, 'name': 'logout', 'label': }, {'active': 
> False, 'name': 'prefs', 'label': }, {'active': False, 'name': 
> 'about', 'label': }]}
>
> I get this, when I refresh the web page in my browser. These menus are 
> dynamic, differs among different users based on the permissions that they 
> have in system. But I wish to generate this without using a browser. So how 
> can I make a web request handling in program itself and the above menus?
>

Are you calling Chrome.get_navigation_items?
https://trac.edgewall.org/browser/tags/trac-1.4/trac/web/chrome.py#L862

You'll need to make a MockRequest. For examples, I believe this is done in 
a few plugins, but I don't recall which off-hand.

I suppose you could use MockRequest from the test module:
https://trac.edgewall.org/browser/tags/trac-1.4/trac/test.py#L151

- Ryan

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/9f7100c7-4a79-489d-9938-bcc0355100bc%40googlegroups.com.


Re: [Trac] Re: How to get all the menus of a user through program?

2020-01-16 Thread Velu Narasimman
well how to use this plugin? I am unable to view any documentation for 
this. Please direct me and how can I get the menus with help of this 
plugin? give me some thoughts.


On Thursday, January 16, 2020 at 3:33:36 PM UTC+5:30, hasienda wrote:
>
> Am 16. Januar 2020 07:34:32 MEZ schrieb Velu Narasimman <
> velava...@gmail.com >:
>>
>> Well, I am getting menu as a dictionary as shown below,
>>
>> {'mainnav': [{'active': False, 'name': 'project', 'label': > >}, {'active': False, 'name': 'added_common', 'label': }, {
>> 'active': False, 'name': 'admin', 'label': }, {'active': 
>> False, 'name': 'reports', 'label': }, {'active': False, 
>> 'name': 'metrics', 'label': }, {'active': False, 'name': 
>> 'mytimesheet', 'label': }, {'active': True, 'name': 
>> 'myprojects', 'label': }, {'active': False, 'name': 
>> 'timesheetapproval', 'label': }], 'metanav': [{'active': 
>> False, 'name': 'login', 'label': u'logged in as karthikeyan.nagaraja'}, {
>> 'active': False, 'name': 'logout', 'label': }, {'active': 
>> False, 'name': 'prefs', 'label': }, {'active': False, 'name'
>> : 'about', 'label': }]}
>>
>> I get this, when I refresh the web page in my browser. These menus are 
>> dynamic, differs among different users based on the permissions that they 
>> have in system. But I wish to generate this without using a browser. So how 
>> can I make a web request handling in program itself and the above menus?
>>
>> 
>>
>> On Thursday, January 16, 2020 at 10:24:17 AM UTC+5:30, Velu Narasimman 
>> wrote:
>>>
>>> Hi,
>>>
>>> I am using MenusPlugin  
>>> for displaying submenus. I need to get all the menus that are about to be 
>>> displayed for a user even before he logs into the site.  Is it possible? If 
>>> yes, how shall I do it in a back-end program? Please share me your ideas.
>>>
>>> Thanks in advance.
>>>
>>
> So you know about XML-RPC-Plugin [1]?
>
> IMHO this is the most standardized non-browser access to enabled Trac 
> sites.
>
> [1] https://trac-hacks.org/wiki/XmlRpcPlugin
>
> Mit freundlichem Gruß
>
> Steffen Hoffmann
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/79e7c408-3994-4888-8237-04d929709742%40googlegroups.com.


Re: [Trac] Re: How to get all the menus of a user through program?

2020-01-16 Thread Steffen Hoffmann
Am 16. Januar 2020 07:34:32 MEZ schrieb Velu Narasimman 
:
>Well, I am getting menu as a dictionary as shown below,
>
>{'mainnav': [{'active': False, 'name': 'project', 'label': "a">}, {
>'active': False, 'name': 'added_common', 'label': },
>{'active': 
>False, 'name': 'admin', 'label': }, {'active': False,
>'name': 
>'reports', 'label': }, {'active': False, 'name':
>'metrics', 
>'label': }, {'active': False, 'name': 'mytimesheet',
>'label': <
>Element "a">}, {'active': True, 'name': 'myprojects', 'label': "a"
>>}, {'active': False, 'name': 'timesheetapproval', 'label': "a">}], 
>'metanav': [{'active': False, 'name': 'login', 'label': u'logged in as 
>karthikeyan.nagaraja'}, {'active': False, 'name': 'logout', 'label': <
>Element "a">}, {'active': False, 'name': 'prefs', 'label': "a">}, {
>'active': False, 'name': 'about', 'label': }]}
>
>I get this, when I refresh the web page in my browser. These menus are 
>dynamic, differs among different users based on the permissions that
>they 
>have in system. But I wish to generate this without using a browser. So
>how 
>can I make a web request handling in program itself and the above
>menus?
>
>
>
>On Thursday, January 16, 2020 at 10:24:17 AM UTC+5:30, Velu Narasimman 
>wrote:
>>
>> Hi,
>>
>> I am using MenusPlugin 
>for 
>> displaying submenus. I need to get all the menus that are about to be
>
>> displayed for a user even before he logs into the site.  Is it
>possible? If 
>> yes, how shall I do it in a back-end program? Please share me your
>ideas.
>>
>> Thanks in advance.
>>
>
>-- 
>You received this message because you are subscribed to the Google
>Groups "Trac Users" group.
>To unsubscribe from this group and stop receiving emails from it, send
>an email to trac-users+unsubscr...@googlegroups.com.
>To view this discussion on the web visit
>https://groups.google.com/d/msgid/trac-users/f1c42bf0-ed49-409d-805a-eaf723829ba9%40googlegroups.com.

So you know about XML-RPC-Plugin [1]?

IMHO this is the most standardized non-browser access to enabled Trac sites.

[1] https://trac-hacks.org/wiki/XmlRpcPlugin

Mit freundlichem Gruß

Steffen Hoffmann

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/2181FE45-9EE8-4CBE-9D4B-7BC04E28D6EE%40web.de.


[Trac] Re: How to get all the menus of a user through program?

2020-01-15 Thread Velu Narasimman
Well, I am getting menu as a dictionary as shown below,

{'mainnav': [{'active': False, 'name': 'project', 'label': }, {
'active': False, 'name': 'added_common', 'label': }, {'active': 
False, 'name': 'admin', 'label': }, {'active': False, 'name': 
'reports', 'label': }, {'active': False, 'name': 'metrics', 
'label': }, {'active': False, 'name': 'mytimesheet', 'label': <
Element "a">}, {'active': True, 'name': 'myprojects', 'label': }, {'active': False, 'name': 'timesheetapproval', 'label': }], 
'metanav': [{'active': False, 'name': 'login', 'label': u'logged in as 
karthikeyan.nagaraja'}, {'active': False, 'name': 'logout', 'label': <
Element "a">}, {'active': False, 'name': 'prefs', 'label': }, {
'active': False, 'name': 'about', 'label': }]}

I get this, when I refresh the web page in my browser. These menus are 
dynamic, differs among different users based on the permissions that they 
have in system. But I wish to generate this without using a browser. So how 
can I make a web request handling in program itself and the above menus?



On Thursday, January 16, 2020 at 10:24:17 AM UTC+5:30, Velu Narasimman 
wrote:
>
> Hi,
>
> I am using MenusPlugin  for 
> displaying submenus. I need to get all the menus that are about to be 
> displayed for a user even before he logs into the site.  Is it possible? If 
> yes, how shall I do it in a back-end program? Please share me your ideas.
>
> Thanks in advance.
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/f1c42bf0-ed49-409d-805a-eaf723829ba9%40googlegroups.com.