Menu
Welcome, Guest
Username: Password: Remember me

TOPIC: Hide subpanel depend on roles

Hide subpanel depend on roles 2 months 1 week ago #85661

  • jrawoot
  • jrawoot's Avatar
  • Offline
  • Senior Member
  • Posts: 69
  • Thank you received: 3
  • Karma: 0
Hello all,
I want to hide some subpanel base on role.
Anyone know how can I achieve this?

Thanks
The administrator has disabled public write access.

Hide subpanel depend on roles 2 months 1 week ago #85685

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 10664
  • Thank you received: 1603
  • Karma: 363
I am not sure it works, but if you disable the entire module in the Role ("access" column) doesn't it remove subpanels?

Also try disabling "List views" since subpanels are derived from List views.

Tell me if this works! Thanks

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Hide subpanel depend on roles 2 months 1 week ago #85703

  • jrawoot
  • jrawoot's Avatar
  • Offline
  • Senior Member
  • Posts: 69
  • Thank you received: 3
  • Karma: 0
HELLO PQR,
Thanks for reply.
I already tried this, but it's not working.
The administrator has disabled public write access.

Hide subpanel depend on roles 2 months 1 week ago #85707

  • jrawoot
  • jrawoot's Avatar
  • Offline
  • Senior Member
  • Posts: 69
  • Thank you received: 3
  • Karma: 0
I have solved this with custom code.
I have create custom file in custom\Extension\modules\Leads\Ext\Layoutdefs/custom_file.php
and add below code. After adding code perform a "Quick Repair and Rebuild".
And it's work for me.
global $mod_strings, $app_strings, $sugar_config;
$objACLRole = new ACLRole();
$roles = $objACLRole->getUserRoles($GLOBALS['current_user']->id);
if($roles[0] == "Call Center"){
		unset($layout_defs["Leads"]["subpanel_setup"]["campaigns"]);
		unset($layout_defs["Leads"]["subpanel_setup"]["securitygroups"]);
}

Thanks
Last Edit: 2 months 1 week ago by pgr. Reason: add code tags
The administrator has disabled public write access.
The following user(s) said Thank You: pgr

Hide subpanel depend on roles 2 months 1 week ago #85725

  • pepemon2018
  • pepemon2018's Avatar
  • Offline
  • Premium Member
  • Posts: 112
  • Thank you received: 6
  • Karma: -1
use javascript to hide subpanel :)
Anomalous <3
The administrator has disabled public write access.
The following user(s) said Thank You: jrawoot

Hide subpanel depend on roles 2 months 1 week ago #85737

  • jrawoot
  • jrawoot's Avatar
  • Offline
  • Senior Member
  • Posts: 69
  • Thank you received: 3
  • Karma: 0
Hi pepemon2018,
Any problem if I write this in Layoutdefs?
I'm new in suitecrm.
Thanks :)
The administrator has disabled public write access.

Hide subpanel depend on roles 2 months 1 week ago #85738

  • diligent
  • diligent's Avatar
  • Offline
  • Moderator
  • Posts: 85
  • Thank you received: 24
  • Karma: 1
I am not sure it works, but if you disable the entire module in the Role ("access" column) doesn't it remove subpanels?

Also try disabling "List views" since subpanels are derived from List views.

Tell me if this works! Thanks

just tested it with the current LTS-version. Created a group, added role+user, works exactly as you described (column access=disabled is sufficient).

Exception: for activities and history I'm unsure if the principle works.
The administrator has disabled public write access.

Hide subpanel depend on roles 2 months 1 week ago #85739

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 10664
  • Thank you received: 1603
  • Karma: 363
Thanks @diligent

About the other discussion, doing it in Layoutdefs versus Javascript, I believe in this case the Layoutdefs is better:

- it's faster handling the request on the server, the subpanel query doesn't run

-less bandwidth consumed, less page load time

- no data will be sent to the front-end, so it's more secure if you really don't mean the data to be there

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Hide subpanel depend on roles 2 months 1 week ago #85740

  • jrawoot
  • jrawoot's Avatar
  • Offline
  • Senior Member
  • Posts: 69
  • Thank you received: 3
  • Karma: 0
Thanks pgr :)
Last Edit: 2 months 1 week ago by jrawoot.
The administrator has disabled public write access.

Hide subpanel depend on roles 2 months 1 week ago #85766

  • pepemon2018
  • pepemon2018's Avatar
  • Offline
  • Premium Member
  • Posts: 112
  • Thank you received: 6
  • Karma: -1
you can create javascript tag in layoutdefs. (y)
Anomalous <3
The administrator has disabled public write access.
The following user(s) said Thank You: jrawoot

Hide subpanel depend on roles 2 months 1 week ago #85768

  • jrawoot
  • jrawoot's Avatar
  • Offline
  • Senior Member
  • Posts: 69
  • Thank you received: 3
  • Karma: 0
Thanks pepemon2018,
I'll try js :)
The administrator has disabled public write access.

Hide subpanel depend on roles 2 months 1 week ago #85769

  • pepemon2018
  • pepemon2018's Avatar
  • Offline
  • Premium Member
  • Posts: 112
  • Thank you received: 6
  • Karma: -1
get Subpanel ID ! then use js :)
Anomalous <3
The administrator has disabled public write access.
The following user(s) said Thank You: jrawoot

Hide subpanel depend on roles 2 months 1 week ago #85781

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 10664
  • Thank you received: 1603
  • Karma: 363
Why would you want to use Javascript for this case?

I gave several reasons above, saying why it't not very adequate. it seems to me it's also a much more convoluted form of achieving the intended purpose.

You can simply tell SuiteCRM not to produce the subpanel, by unsetting a value in a array. Why would you want to tell it to produce the subpanel anyway, send it to the client, but inject Javascript in it, so it can then be insecurely hidden?

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.
The following user(s) said Thank You: jrawoot
Time to create page: 0.079 seconds
Powered by Kunena Forum