View ProjeQtOr On SourceForge.net
ProjeQtOr - Project Management Tool
Support us on Capterra
OIN - Open Invention Network
ProjeQtOr free project management software - [9.3.4-9.5.0] API issue on PlanningElements access rights - ProjeQtOr
 
 

[9.3.4-9.5.0] API issue on PlanningElements access rights

More
29 Mar 2022 15:53 #1 by fsouliers
Hello,
I tried the following behavior from 9.3.4 to 9.5.0 and Projeqtor always behaves the same.

my account has almost every access rights on our Projeqtor instance and my profile is not a native one (I have created it by hand in Projeqtor, and its code is also ADM to allow it to perform software updates).
On the gui, I can see everything, without any problem, in particular all the information contained in planningelements.
when trying to access a particular planningelement with the API (eg BASE_URL/PlanningElement/search/refType='Activity'/refId=118 or such as BASE_URL/PlanningElement/88), I get an empty result. This is due to the $listNO (method getAccesRestrictionClause in tool/projeqtor.php:2071 in v9.5.0), as if my user was suddenly not allowed to read some projects.
I would obviously expect to access the same things with the same rights in the gui and from the API.

From the tests I made, I imagine the content of $user->getAccessRights($objectClass, 'NO', $showIdle) is buggy  when objectClass is 'PlanningElement'.
I therefore wrote the very worst workaround ever, adding the following just before this previous line : if ($objectClass == 'PlanningElement') $objectClass = 'Project' ;
It works properly because in my particular case I have no other restriction, but I guess it would be very buggy if I had profile restrictions eg on meetings, milestones or other stuff that ends as a planningelement (ie when the user can see the project but not all of its content).

As a result, as it seems you are about to touch the API (and therefore test it), maybe this access right part needs a little bit of reviewing.

Hope this helps,


 

Please Log in or Create an account to join the conversation.

More
29 Mar 2022 16:10 #2 by caccia
Hi,

Good point - it's a subject that also interests me very much to better use the API :)
I have seen in the past (older versions, haven't checked recently) this behaviour, and used the same workaround. I found that the workaround works ok for our use case, but of course it's difficult to generalize.

So if we can find a better way to handle the API access rights on these types of objects, because it would allow us to extend the use of APIs. It's something I'm looking forward to a lot, because it's a great way to give end users more flexibility in generating customized reports for example.

If I can help , for example to provide some use cases that we would like to manage through the API, let me know :)
 

Please Log in or Create an account to join the conversation.

More
30 Mar 2022 09:21 #3 by babynus

I get an empty result. This is due to the $listNO (method getAccesRestrictionClause in tool/projeqtor.php:2071 in v9.5.0), as if my user was suddenly not allowed to read some projects.
I would obviously expect to access the same things with the same rights in the gui and from the API.

You get the same behavior as in the GUI : there is no sreen to list PlanningElement items.
In fact, in hte Objects of Projeqtor PlanningElement is a part of another item.
In your case, you should just get the Activity, you'll get the data on PlanningElement for this activity.

 if ($objectClass == 'PlanningElement') $objectClass = 'Project' ;

This is in fact really buggy.
You could write 
 if ($objectClass == 'ProjectPlanningElement') $objectClass = 'Project' ;  
else if ($objectClass == 'ActivityPlanningElement') $objectClass = 'Activity' ;
and so on for each class that includes PlanningElement (planable obkjects)

But really, you'd better acces the Activity...

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

More
30 Mar 2022 10:53 #4 by fsouliers
Hi Babynus,
You’re absolutely right, so many thanks for your answer; I now understand the philosophy.

... so I have just rewinded a little bit to understand why we took such a complicated & useless way and decided to walk through PlanningElements.
When we tried to add Dependencies through the API, we only were able to mention refType and RefId in the data transmitted, but not what I identified as the planningelement ids. As a consequence, the planning was completely wrong.
Is there any magic I’m also missing here? (in other words, how am I supposed to post Dependencies ?)
 

Please Log in or Create an account to join the conversation.

More
30 Mar 2022 11:44 #5 by babynus
When you want to insert a dependency, just define predecessorRefType and predecessorRefId, the predecessosId will be set automatically (same for successor)

Babynus
Administrator of ProjeQtOr web site

Please Log in or Create an account to join the conversation.

More
30 Mar 2022 12:34 - 30 Mar 2022 12:35 #6 by fsouliers
Well, actually, when trying to POST the following to BASE_URL/Dependency :
data = {'predecessorRefType': 'Activity','predecessorRefId': '2034','successorRefType': 'Activity','successorRefId': '2035','dependencyType': 'E-S', 'dependencyDelay': '0', 'comment': 'test comment'}

There is no error in the logs, the API answers  the following (and I swear we did not modified the code of Projeqtor) :
{'identifier': 'id', 'items': [{'apiResult': 'OK', 'apiResultMessage': 'Lien de dépendance #1332 inséré', 'id': '1332', 'predecessorId': '', 'predecessorRefType': 'Activity', 'predecessorRefId': '2034', 'successorId': '', 'successorRefType': 'Activity', 'successorRefId': '2035', 'dependencyType': 'E-S', 'dependencyDelay': '0', 'comment': 'test comment'}]}

The fields successorId and predecessorId are NULL in the database (which is consistent with the answer of the API) and there is no arrow drawed on the Gantt view (which seems quite normal regarding the data I guess).
Even if recalculating the planning, the NULL values remain NULL.

I can see successor & predecessor correctly set in the activities view (which seems also quite normal regarding the data).

Am I doing something wrong?
Last edit: 30 Mar 2022 12:35 by fsouliers.

Please Log in or Create an account to join the conversation.

Moderators: babynusprotion
Time to create page: 0.052 seconds

Cookies settings

×

Functional Cookies

Ce site utilise des cookies pour assurer son bon fonctionnement et ne peuvent pas être désactivés de nos systèmes. Nous ne les utilisons pas à des fins publicitaires. Si ces cookies sont bloqués, certaines parties du site ne pourront pas fonctionner.

Session

Please login to see yours activities!

Other cookies

Ce site web utilise un certain nombre de cookies pour gérer, par exemple, les sessions utilisateurs.