Page 1 of 1

Enable/disable my extension by profiles

PostPosted:Sun May 05, 2019 5:54 am
by mamad
Hi dear Jllort,
Based on openkm documentations from here :https://docs.openkm.com/kcenter/view/ok ... nd-ui.html , i created an extension and successfully add it to the Tab Document.
The extensions will show correctly for each document in tab document panel but i don't want this tab to be shown for all users and i need to add a check box in Profiles -> Component -> Tab Document to handle showing/hiding my custom tab based on different profiles.
How to do this ?
I'm using openkm 6.3 community edition and extend openkm using your configured development environment.
Thanks in advance

Re: Enable/disable my extension by profiles

PostPosted:Sun May 05, 2019 6:01 am
by mamad
I guess i can do this by adding my extension to OKM_EXTENSION table
some thing like :
Code: Select all
INSERT INTO OKM_EXTENSION (EXT_UUID,EXT_NAME) VALUES('Extension UUID','Extension Name');
But whats extension uuid ? how i set an uuid for my extension ? How generate it ? does it has a special format or just a string value ?

Re: Enable/disable my extension by profiles

PostPosted:Tue May 07, 2019 10:38 pm
by jllort
Should also modify the class Customization.java to get it working in the same manner.

Re: Enable/disable my extension by profiles

PostPosted:Wed May 22, 2019 8:40 am
by mamad
well , but how to do this ?
In Customization.java class , I add my extension to extensions list using :
Code: Select all
extensions.add(new MyTab()); // MyTab is my custom tab
but no option added to profiles menu to set visibility of my extension based on that profile

Re: Enable/disable my extension by profiles

PostPosted:Wed May 22, 2019 8:57 am
by mamad
Please also tell me how to find the role of user in my extension.
I want to show some part of my extension(for example some buttons) only to users with specific role(maybe just admin role).
Please tell me how to find this ?
for example i can find the document using this line of code : TabDocumentComunicator.getDocument()
i want some thing like this to find the user and its role.some thing like : ?.getUser() to return the current user to me !

Re: Enable/disable my extension by profiles

PostPosted:Thu May 23, 2019 8:12 pm
by jllort
Take a look at methods getUserRoleList in the class GeneralCommunicator.java

Re: Enable/disable my extension by profiles

PostPosted:Sat May 25, 2019 5:13 am
by mamad
That was exactly what i want :wink:
Thank you so much