News:

Looking for a good read? Check out the SimpleDesk Team Blog.

Main Menu

Membership in multiple departments

Started by clarinet, February 15, 2013, 11:50:24 AM

Previous topic - Next topic

clarinet

Perhaps I am misinterpreting the Department philosophy, but I can't get it working as I would like to. I have three departments A, B, and C, and three groups GroupA, GroupB, and GroupC. Also, I have three roles: GroupA is assigned RoleA in department A, GroupB is assigned RoleB in department B, etc. (I tried to attach images/screenshots, but the server did not allow me to do so).

Now, when a user is member of two groups, GroupA and GroupB, I would expect this user should be able to submit tickets to both departments A and B. However, this user does not have an option to select or change department and his/her tickets are automatically submited to B. How can I enable this user to select proper department for the ticket? Or what is it that I miss? Thank you.

venguard223

The user isn't staff in one department and a user in another?

Also, check the URL in question when they're submitting. If they're in a department (i.e. there's a dept= in the URL), it will assume that's the department they're submitting to.

There are a great many flaws in the structure of departments. It's pretty much broken but the original developer can't be bothered to fix it since his preferred solution is a complete ground up rewrite.

clarinet

#2
The user has equal roles in all departments. All three roles (RoleA, RoleB, RoleC) are simple derivatives of the same role template "Helpdesk Users".

I checked the URL, but it contains nothing more than "index.php".

According to your explanation it seems that I will have to give it up ...  :-(

Edited 5pm local time:

After many tests I now see how it works. The system just does not assign the user the union of all roles based on all this user's group memberships,  but just a single role that corresponds to the first (or last, I am not sure) group this user is a member of.

So if I want a user to be assigned to two departments A and B, the only way is to:

a) create group GroupAB and make this user member of this group
b) make sure this user is not a member of GroupA, GroupB or GroupC or any other group that has defined a role in any department
c) create a role RoleAB that assigns members of GroupAB to departments A and B

It is not as elegant as one can imagine, but as I only need several combinations, I guess I can live with it. I think it should not be very hard to repair, but if the author prefers complete rewrite, I can understand it.



venguard223

QuoteThe system just does not assign the user the union of all roles based on all this user's group memberships

It's supposed to be the union of all roles based on the membergroups the user is in.

QuoteI think it should not be very hard to repair, but if the author prefers complete rewrite, I can understand it.

Trust me, it is. A rewrite is by far the best solution.

clarinet

Quote from: venguard223 on February 18, 2013, 06:28:39 PM
QuoteThe system just does not assign the user the union of all roles based on all this user's group memberships

It's supposed to be the union of all roles based on the membergroups the user is in.

Yes, I understand, this is what I expected. However, unless I keep repeating some stupid mistake, in reality it does work like this. The user is assigned just one role based on the first membergroup the user is in.

Quote from: venguard223 on February 18, 2013, 06:28:39 PM
QuoteI think it should not be very hard to repair, but if the author prefers complete rewrite, I can understand it.

Trust me, it is. A rewrite is by far the best solution.

I trust you, of course. I can imagine the code is extremely complicated as the relationships among objects and attributes are complex. As I found a workaround for my problem, it is solved for the moment and I will look forward to the rewritten version (if there are plans to release any).

In any case thanks to all authors, despite some small details it is an excellent job.

venguard223

QuoteThe user is assigned just one role based on the first membergroup the user is in.

There is certainly a bug attached to it, yes.

QuoteAs I found a workaround for my problem, it is solved for the moment and I will look forward to the rewritten version (if there are plans to release any).

The original author will never release a patched version for SMF, I can tell you that. He does not develop for SMF any longer, only for a rival forum software. Given how long this bug has been around and how no effort has apparently been made to fix it by the current devs, it seems unlikely SimpleDesk itself will ever be fixed.

clarinet

Well, I could not help myself ... it was not that hard. Edit file ./Sources/sd_source/Subs-SimpleDeskPermissions.php, replace line 364


$user_info['shd_permissions'][$perm] = $depts[$role];


with


if(is_array($user_info['shd_permissions'][$perm]))
$user_info['shd_permissions'][$perm] = array_merge($user_info['shd_permissions'][$perm],$depts[$role]);
else
$user_info['shd_permissions'][$perm] = $depts[$role];


I hope it's all that needs to be done. If you ever happen to see the original developer, please tell him. :-)

venguard223

#7
I AM the original developer. ;) I won't be releasing SMF releases (I long since ported the bulk of it to Wedge)

And yes, at a glance that looks pretty good, especially since the entirety of access is also dependent on those permissions.

I'll patch it (slightly differently, but doing the same thing), and submit a pull request for the team to integrate it. But I'm still waiting for them to revert a change from 2011 that I specifically told them not to make in the first place. (The comment in the line before actually indicates why it should not be done!) so let's just say I wouldn't be hopeful.


EDIT: Sent a pull request, thank you for your help on this one, it's been a bug for years but I long since lost the interest in actually tracking it down.

clarinet

#8
Thank you for comments. I think will have a look at Wedge too, but now I already run SMF/SimpleDesk so it would not be easy to migrate.

EDIT: Looks like I will not have a look at Wedge at the moment - it seems it was not released yet.

venguard223

#9
That would be because it is still under heavy development, including by me... ;)

ETA: The changes in Wedge are substantial, though, and I'm not sure how reliable a port would be at this stage simply because I'm doing more than just porting it. It's heading towards rewrite territory.

Ice_Drake1

Quote from: clarinet on March 04, 2013, 08:42:29 AM
Well, I could not help myself ... it was not that hard. Edit file ./Sources/sd_source/Subs-SimpleDeskPermissions.php, replace line 364


$user_info['shd_permissions'][$perm] = $depts[$role];


with


if(is_array($user_info['shd_permissions'][$perm]))
$user_info['shd_permissions'][$perm] = array_merge($user_info['shd_permissions'][$perm],$depts[$role]);
else
$user_info['shd_permissions'][$perm] = $depts[$role];


...


This line raises undefined index errors below for any external pages that is not entirely integrated with SMF.


Notice: Undefined index: access_helpdesk in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ticket_private_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_closed_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_new_ticket in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_edit_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_reply_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_edit_reply_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_attachment in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_post_attachment in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_resolve_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_unresolve_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ticket_logs_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_profile_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_profile_log_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_preferences_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_relationships in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_delete_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_delete_reply_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_staff in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ticket_private_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_closed_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ip_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_edit_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_reply_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_edit_reply_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_post_proxy in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_monitor_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_singleton_email in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_ignore_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_silent_update in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_resolve_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_unresolve_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_ticket_logs_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_alter_urgency_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_alter_privacy_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_assign_ticket_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_profile_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_view_profile_log_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_create_relationships in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_delete_relationships in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_access_recyclebin in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_delete_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_delete_reply_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_restore_ticket_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_restore_reply_any in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_ticket_to_topic in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_topic_to_ticket in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Notice: Undefined index: shd_move_dept_own in /home/etheriac/public_html/Sources/sd_source/Subs-SimpleDeskPermissions.php on line 364

Is there something I can do to fix this problem?

venguard223


Ice_Drake1

"Not entirely integrated" meant that SMF encapsulates the external page to be a part of it although it isn't really a part of it. SMF just load up an external page while the external page loads up nothing related to SMF.

venguard223

That wasn't what I really wanted to know. If you'd like help on fixing this, you do sort of need to provide details of what you've done so I can try to figure out how to change it for you.

Ice_Drake1

In order to encapsulate an external page (e.g. http://ethera.servehttp.com/Coppermine/), I used the following codes as a theme template page, which will be called by SMF:


<?php
// Version: 1.1 RC2; Gallery

function template_main()
{
global $context$settings$options$txt$scripturl;

echo '
<script language="JavaScript" type="text/javascript"><!--
function checkAll(onOff)
{
for (var i = 0; i < document.searchform.elements.length; i++)
{
if (document.searchform.elements[i].name.substr(0, 3) == "brd")
document.searchform.elements[i].checked = onOff;
}
}
// --></script>
<form action="'
$scripturl'?action=search2" method="post" name="searchform" id="searchform">

 <script type="text/javascript"><!--

/***********************************************
* IFrame SSI script II- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/

//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=["myframe"]

//Should script hide iframe from browsers that don\'t support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes"

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight; 
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

// --></script>

<table width="100%" border="0" cellspacing="0" cellpadding="4" align="center" class="tborder">
<tr>
<td class="windowbg">'
;

// load the gallery
echo '<iframe id="myframe" src="http://ethera.servehttp.com/Coppermine/" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:novisible; width:100%; display:none"></iframe>';

echo '
</td>
</tr>
</table>
</form>'
;
}

?>



I included the following line somewhere in the external page to load up some variables.


...
include_once($_SERVER['DOCUMENT_ROOT'].'/SSI.php');
...


While this setup gives me no error as an administrator, when using as other users, the notices appear.