Enable/disable my extension by profiles

OpenKM has many interesting features, but requires some configuration process to show its full potential.
Forum rules
Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
Post Reply
mamad
Expert Boarder
Expert Boarder
Posts: 112
Joined: Mon Jun 25, 2018 5:13 am

Enable/disable my extension by profiles

Post by mamad » Sun May 05, 2019 5:54 am

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

mamad
Expert Boarder
Expert Boarder
Posts: 112
Joined: Mon Jun 25, 2018 5:13 am

Re: Enable/disable my extension by profiles

Post by mamad » Sun May 05, 2019 6:01 am

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 ?

jllort
Moderator
Moderator
Posts: 10868
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Enable/disable my extension by profiles

Post by jllort » Tue May 07, 2019 10:38 pm

Should also modify the class Customization.java to get it working in the same manner.

mamad
Expert Boarder
Expert Boarder
Posts: 112
Joined: Mon Jun 25, 2018 5:13 am

Re: Enable/disable my extension by profiles

Post by mamad » Wed May 22, 2019 8:40 am

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

mamad
Expert Boarder
Expert Boarder
Posts: 112
Joined: Mon Jun 25, 2018 5:13 am

Re: Enable/disable my extension by profiles

Post by mamad » Wed May 22, 2019 8:57 am

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 !

jllort
Moderator
Moderator
Posts: 10868
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: Enable/disable my extension by profiles

Post by jllort » Thu May 23, 2019 8:12 pm

Take a look at methods getUserRoleList in the class GeneralCommunicator.java

mamad
Expert Boarder
Expert Boarder
Posts: 112
Joined: Mon Jun 25, 2018 5:13 am

Re: Enable/disable my extension by profiles

Post by mamad » Sat May 25, 2019 5:13 am

That was exactly what i want :wink:
Thank you so much

Post Reply