SimpleDesk

SimpleDesk! => SimpleDesk Discussion => Topic started by: Ice_Drake1 on August 10, 2012, 08:48:43 PM

Title: Staff Access to two Department bug?
Post by: Ice_Drake1 on August 10, 2012, 08:48:43 PM
Hi, I tried to search around the forum for answers to my problem, but I have no luck.

Right now, I am using SMF 2.0.2 with SimpleDesk 2.0 installed along with many other mods. I recently found out that my staffs don't have access to both departments I assigned them to. As an administrator, it makes sense to see both departments, but other users only see one of the two departments. I figured that it must be a bug, so I am here asking for help to fix this problem.
Title: Re: Staff Access to two Department bug?
Post by: venguard223 on August 10, 2012, 09:24:56 PM
So you're an administrator, you can see all departments. The odds of them being able to see only one department is more likely a configuration issue than a bug.

So, how *exactly* is it configured? You've not told me anything about how anything is set up.
Title: Re: Staff Access to two Department bug?
Post by: Ice_Drake1 on August 10, 2012, 09:58:45 PM
That is what I thought about, too. So I double check the permission to see if it is correct, but I see no problem.

I have two departments: Helpdesk and Workdesk.

Helpdesk Users and Helpdesk Staffs are part of Helpdesk, and Workdesk Users and Workdesk Staffs are part of Workdesk. The membergroup I am having trouble with is Game Designers. I set them to be part of Helpdesk Users and Workdesk Staffs, but they only see Workdesk...they don't see Helpdesk.

Helpdesk Users and Workdesk Users are based on default Helpdesk Users permission, and Workdesk Users and Workdesk Staffs are based on default Helpdesk Staffs permission.
Title: Re: Staff Access to two Department bug?
Post by: venguard223 on August 10, 2012, 10:42:20 PM
What kind of membergroup is Game Designers?

Screenshots would probably help at this point too, of everything.
Title: Re: Staff Access to two Department bug?
Post by: Ice_Drake1 on August 11, 2012, 01:08:26 AM
I am not sure what you mean by "What kind of membergroup is Game Designers?". I think you are referring that it is a specially assigned membergroup that has more permission than a regular member.

Here is a visual of the departments I am talking about:
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fethera.servehttp.com%2Ftemp%2FUntitled-1.jpg&hash=6b93c7d70482c2a9e910be5a7bf208d39561f858)

Here is a visual of editing the role of Helpdesk Users:
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fethera.servehttp.com%2Ftemp%2FUntitled-2.jpg&hash=b2a9023bc12f93b881f31818577a6280a9910964)
Title: Re: Staff Access to two Department bug?
Post by: venguard223 on August 11, 2012, 03:03:16 PM
QuoteI am not sure what you mean by "What kind of membergroup is Game Designers?". I think you are referring that it is a specially assigned membergroup that has more permission than a regular member.

I'm primarily getting at whether it is an inherited or otherwise based on another group.

How's the department configured? Where is it not visible, exactly?

/me wonders if he should offer to look at the full admin himself, could probably solve it faster that way...
Title: Re: Staff Access to two Department bug?
Post by: Ice_Drake1 on August 11, 2012, 08:37:24 PM
Oh, Game Designers originally inherited from Regular Members and made unique afterward with the extra permissions. Regular Members can see Helpdesk, but not Workdesk, which is correct...but I don't understand why Game Designers can't see Workdesk when they are supposed to.

Quote from: venguard223 on August 11, 2012, 03:03:16 PM
How's the department configured? Where is it not visible, exactly?

Uh...as for the department configuration, it is shown on the first visual. The whole Helpdesk department is completely hidden for Game Designers. It is not shown in under General nor is it shown in Helpdesk tab as if they don't have access to it at all.

Here is a better visual of the permission for the two departments:
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fethera.servehttp.com%2Ftemp%2FUntitled-3.jpg&hash=374c67db40bbac93bdd6ad5d9dd2043e9bc54cf4)

Membergroup "Alpha Testers" are having the same problem.
Title: Re: Staff Access to two Department bug?
Post by: venguard223 on August 12, 2012, 10:15:07 AM
Still need to know more about these groups and the users who have these groups, what groups do they have?

Also, go to the profile of a user in these groups and pull up a list of their permissions in the helpdesk, that will show you what permissions they have access to.
Title: Re: Staff Access to two Department bug?
Post by: Ice_Drake1 on August 12, 2012, 10:51:06 PM
Quote from: venguard223 on August 12, 2012, 10:15:07 AM
Still need to know more about these groups and the users who have these groups, what groups do they have?

Also, go to the profile of a user in these groups and pull up a list of their permissions in the helpdesk, that will show you what permissions they have access to.

I am not sure what more do you want to know about these groups since it is specified clearly on 3rd visual. For instance, from the visual, Regular Members, Family, Game Designer, Game Developer, Alpha Tester, Game Moderator, Beta Tester, and Graphic Designer makes up Helpdesk Users. Regular Members can view Helpdesk, but only membergroups that are part of two departments can't see Helpdesk. That includes Alpha Testers, Game Designers, Game Developers, and Game Moderators.

Here is a visual list of permissions for Helpdesk of a member named "test" I placed temporary as a Game Designer, which you requested for:
(https://www.simpledesk.net/community/proxy.php?request=http%3A%2F%2Fethera.servehttp.com%2Ftemp%2FUntitled-4.jpg&hash=1e4bcfe3dbd4031aec19414b57234a70cfd3a4f2)

As mentioned before, the permission is based on the default permission of Helpdesk Users.
Title: Re: Staff Access to two Department bug?
Post by: Spoogs on August 12, 2012, 11:31:07 PM
I'm having a hard time wrapping my head around what would be causing this.

I agree with venguard here that it'd be better to see the setup from admin view to really nail this down.

I can vouch for venguard that was the lead developer and developed the MAJORITY of SimpleDesk
Title: Re: Staff Access to two Department bug?
Post by: Ice_Drake1 on August 13, 2012, 02:21:49 AM
Oh, I see...here is a link to a duplicate of my forum without the junks: http://ethera.servehttp.com/temp/SMF/

Administrator Account
Username: admin
Password: password

Test Account
Username: test
Password: test

Please feel free to do whatever on it to investigate the problem.
Title: Re: Staff Access to two Department bug?
Post by: Spoogs on August 13, 2012, 11:51:04 AM
SO I took a look and this is beyond me. Everything looks fine but I can confirm Designer cannot see Helpdesk and only able to see Workdesk though permissions are set to see both. Designer is a User in the Helpdesk and Staff in the Workdesk.

All forum boards are deleted and SD is being displayed as boards on the board index. not sure if a mod would be causing this but installed are:
1.   Adk Rules Posts   1.0   [ Uninstall ]
2.   Spiders Don't Increase Topic Views   1.1.1   [ Uninstall ]
3.   SimpleDesk - Integrated Helpdesk for Simple Machines Forum   2.0   [ Uninstall ]
4.   SMFShop   3.2   [ Uninstall ]
5.   Happy Birthday   0.3   [ Uninstall ]
6.   FAQ Mod   1.2   [ Uninstall ]
7.   Add Social Media Icons To Profiles   1.0.5   [ Uninstall ]
8.   Adk Snow Effect   2.0   [ Uninstall ]
9.   Aeva Media   1.4w   [ Uninstall ]
10.   Medal Honor For Years   1.0   [ Uninstall ]
11.   System Post Comment   2.0   [ Uninstall ]
12.   Adk Top Karma   1.0   [ Uninstall ]
13.   Limit Karma   1.4   [ Uninstall ]
14.   PortaMx 1.45   1.45   [ Uninstall ]

Nothing really seems out of play to me. I created a local test but can't reproduce this.

Title: Re: Staff Access to two Department bug?
Post by: Spoogs on August 13, 2012, 12:00:37 PM
When I remove Designer's access to the Workdesk, the Helpdesk becomes visible.

I'm really lost here.
Title: Re: Staff Access to two Department bug?
Post by: venguard223 on August 13, 2012, 01:09:30 PM
This is absolutely ****ing weird.

The test user is definitely in both departments - their profile indicates that quite happily (and you can switch between the departments to validate that's the case)

I also can't replicate it on a local set up (because I've tried!) and when I originally wrote that code I wrote it all to work as expected, the only fringe cases should have been related to groups that weren't proper member groups but they've long been known about.

None of the mods there should be touching the helpdesk permissions code either or its variable.
Title: Re: Staff Access to two Department bug?
Post by: Spoogs on August 13, 2012, 02:46:39 PM
Yeah this one just isnt ringing home. Didn't really expect it to make a difference but I deleted the game Designer Group and added it back and the problem persists.

I'll try a few more scenarios later.
Title: Re: Staff Access to two Department bug?
Post by: Ice_Drake1 on August 13, 2012, 05:38:47 PM
Could it be coming from PortaMx 1.45? I did encounter a bug with it back then preventing other users from accessing the front page, so I fixed the code on one of their files to fix it.

From this in PortaMX.php:
if(empty($useFront) || !empty($context['pmx']['show_frontpanel']) || !empty($context['pmx']['show_pagespanel']) || !empty($_GET['pmxerror']))

to:
if(!empty($useFront) || !empty($context['pmx']['show_frontpanel']) || !empty($context['pmx']['show_pagespanel']) || !empty($_GET['pmxerror']))

Also, I manually installed SMFPets 0.3 since it doesn't support newer than SMF 1.1.
Title: Re: Staff Access to two Department bug?
Post by: Spoogs on August 13, 2012, 05:50:11 PM
Ven can weigh in on that but I doubt that's the problem. I disabled the portal all together http://site/index.php?pmxportal=off and it still occurred.

If I however made Game Designer staff in both departments both became visible. I'll try another local setup later on and see if I can duplicate it this time.
Title: Re: Staff Access to two Department bug?
Post by: Spoogs on August 13, 2012, 07:58:50 PM
Ok this is an actual bug, only happens when member is User in 1 dept and Staff in another.
I was certain this was fixed in issue 577 (http://www.simpledesk.net/community/index.php?issue=577.0)
QuoteThe checks for members being allowed to do a permission does not cover for departments, while all the user-side checks do.

Needs to have the option of being a per-dept check as well as any-dept, much as shd_allowed_to offers.

Basically what I'm seeing now is that if user is staff in at least 1 dept, they will only see the depts in which they are staff.

If they are staff in both depts they will see the both.
if they are user in both depts they will see the both.
Title: Re: Staff Access to two Department bug?
Post by: venguard223 on August 13, 2012, 09:17:53 PM
Issue 577 is mostly unrelated.

Hmm, if this is an actual bug, I still can't reproduce it.
Title: Re: Staff Access to two Department bug?
Post by: Spoogs on August 13, 2012, 09:44:46 PM
I took a fresh install, created a 2nd user and made it a GMod
Created Helpdesk user and helpdesk staff
Created Workdesk as a dept
Made GMod a user in HelpDesk abut staff in WorkDesk and booom there we go... GMod can only see Workdesk where he is staff.

For fun I created TestDesk and played with many variations and each time that GMod had staff and user roles, only the dept with tha staff roll was visible.

I wasnt able to repro it before but it's constant now
Title: Re: Staff Access to two Department bug?
Post by: venguard223 on August 13, 2012, 10:05:59 PM
Yay another permissions bug relating to departments, though I honestly thought they'd all been nailed after a period of about three weeks finding one bug after another >_<

If I get time I'll look into it, but no promises. If I do find something I'll document the patch on Github (not that I like Github, mind)
Title: Re: Staff Access to two Department bug?
Post by: Spoogs on August 13, 2012, 10:12:44 PM
I'm shocked too, I remember us getting real brutal with the testing once you deployed departments. I don't like git much either, never wrapped my head around that thing.
Title: Re: Staff Access to two Department bug?
Post by: Ice_Drake1 on August 13, 2012, 10:48:54 PM
I guess it is good news that you guys found the source of the problem...any pointer on where I can look for this bug? Or do I just wait?
Title: Re: Staff Access to two Department bug?
Post by: Spoogs on August 13, 2012, 11:14:14 PM
Well we havent found the source just yet but rather able to reproduce the bug. As Ven said, if'when he gets the chance he may look into it.

Thanks for the report but just like you for right now we all wait... as you may have noticed development has been rather nil for a bit.
Title: Re: Staff Access to two Department bug?
Post by: Ice_Drake1 on August 14, 2012, 12:16:04 AM
Yeah, that is why I request a pointer on direction and I might be able to figure out how to fix it on my own as I have fixed issues for other mods already.
Title: Re: Staff Access to two Department bug?
Post by: venguard223 on August 15, 2012, 02:00:33 PM
You're still pretty much waiting for me in any case because I'm the one who wrote *all* of that code and even I don't remember a lot of it in places seeing how we're over a year on.

I've also had some pretty murky personal stuff today so I honestly have no idea about looking at the code any time soon, sorry :(
Title: Re: Staff Access to two Department bug?
Post by: Ice_Drake1 on August 30, 2012, 02:00:46 AM
sigh...I gave a try at the codes, but to no avail. :(

The codes are far too complicated for me. There are way too much arrays and variables to keep track of. I gave up! It would take too much time just to figure where the source of the problem is when I have other bugs to fry for my game.

Please let me know whenever you have some ideas or time of where the problem might be. Thanks!
Title: Re: Staff Access to two Department bug?
Post by: venguard223 on August 30, 2012, 03:43:49 PM
QuoteThere are way too much arrays and variables to keep track of.

Yup, and what's in SD is only a fraction of the arrays and variables in SMF in total, and I had to keep pretty much all of them all in my mind at once. I'm sorry, I've had so much personal stuff going on lately that I haven't had time to debug something I wrote a year ago.
Title: Re: Staff Access to two Department bug?
Post by: Ice_Drake1 on March 22, 2013, 07:38:10 PM
I found the source of the problem after finally figuring how to debug for it, but I don't know how to fix it. Any advice?

The problem is in this query found in Subs-SimpleDeskPermissions.php:

// 1. Get all the roles that conceivably apply to this user.
$query = $smcFunc['db_query']('', '
SELECT hdrg.id_role, hdr.template
FROM {db_prefix}helpdesk_role_groups AS hdrg
INNER JOIN {db_prefix}helpdesk_roles AS hdr ON (hdrg.id_role = hdr.id_role)
WHERE hdrg.id_group IN ({array_int:groups})',
array(
'groups' => $user_info['groups'],
)
);

$roles = array();


I did an array dump for $roles:

Array
(
    [0] => Array
        (
            [id_role] => 1
            [template] => 1
        )

    [1] => Array
        (
            [id_role] => 2
            [template] => 2
        )
)


This array is missing the array below:

    [2] => Array
        (
            [id_role] => 5
            [template] => 2
        )


The query is wrong because of the wrong merges.


The array $user_info['groups'] is consists of:

Array
(
    [0] => 24
    [1] => 4
    [2] => 17
)


The contents of helpdesk_role_groups are as follows:

 
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
id_roleid_group
111
112
113
114
116
118
124
214
217
32
315
413
414
511
512
524

The contents of helpdesk_roles are as follows:

 
   
   
   
   
   
   
id_roletemplaterole_name
11Helpdesk Users
22Helpdesk Staff
34Helpdesk Managers
41Workdesk Users
52Workdesk Staff
Title: Re: Staff Access to two Department bug?
Post by: venguard223 on March 23, 2013, 03:18:53 PM
http://www.simpledesk.net/community/index.php?topic=1296.msg11437#msg11437