PDA

View Full Version : Links module with Version 2.0-alpha


jkwalnut
10-02-05, 02:31 AM
Anyone get t his working? I've managed to change some sql for the new db schema but have not tried to understand the permission stuff.

I'm new to this, just installed to manage a few projects.

Do I have to port the whole thing? Any help appreciated.

cyberhorse
10-02-05, 01:08 PM
I have just updated it and it should work with the new permissions system. Just add access to the links module.

I've also fixed the setup table creation problem, some sql errors, translation bug, and a few more things. Please try current cvs version of the links module, and let me know if you find any problems with it.

jkwalnut
10-02-05, 01:17 PM
Wow! Thanks, I certainly didn't expect that kind of turnaround. I'll give it a try.

jkwalnut
10-02-05, 03:03 PM
Ok, some problems:

you changed index.php & setup.php, right?

Those are the only cvs changes I see today.

The SQL in the addedit.php & index_table.php is incorrect. It needs to reference the contacts table for firstname & lastname since they are no longer in the user table.

I've changed that locally and I am able to add new links, but cannot get them to display in the table.

Let me know if you want me to send you the changes i have made.

cyberhorse
11-02-05, 12:40 AM
actually I changed addedit.php and index_table.php as well, but since the developer's cvs is a few hours ahead of the anonymous one, you wouldn't see the changes until tomorrow probably. Anyway, I hadn't thought of the names change, and I'll look into it.

I inserted links fine so I guess I must have fixed something right ... I hope :)

jkwalnut
11-02-05, 06:55 AM
Ok, I've got the latest and merged the SQL change to get rid of the field errors. I still cannot view the link records in the table view after creation.

Here are the sql changes:

addedit.php:

$sql = "
SELECT links.*,
user_username,
contact_first_name,
contact_last_name,
project_id,
task_id, task_name
FROM links, contacts
LEFT JOIN users ON link_owner = user_id
LEFT JOIN projects ON project_id = link_project
LEFT JOIN tasks ON task_id = link_task
WHERE link_id = $link_id AND contact_id = user_id
";

index_table.php:

$sql = "
SELECT links.*,
project_name, project_color_identifier, project_active,
contact_first_name, contact_last_name,task_name,task_id
FROM links, permissions, contacts
LEFT JOIN projects ON project_id = link_project
LEFT JOIN users ON user_id = link_owner
LEFT JOIN tasks on link_task = task_id
WHERE
contact_id = user_id
AND permission_user = $AppUI->user_id
$catsql $search_sql
AND permission_value <> 0
AND (
(permission_grant_on = 'all')
OR (permission_grant_on = 'projects' AND permission_item = -1)
OR (permission_grant_on = 'projects' AND permission_item = project_id)
)

Thanks.

jkwalnut
11-02-05, 07:13 AM
After more investigation there seems to be some kind of user permission problem. I have a user I have setup with all privileges, and that user adds some links, but they do not show up for display.

If I login as admin, I am now seeing the links. Another strange thing is that as admin, I can no longer see the other user accounts. The admin is the only user account visible to either the admin or the secondary accounts.

Any ideas?

cyberhorse
11-02-05, 04:39 PM
there is some weirdness in the permissions system still - I think you have to assign specific permissions to the links module, as it's not one of the system modules or something ... did you try uninstalling it and then installing it again?

btw, in the above sql queries - you have a mistace 'contact_id = user_id' should be 'contact_id = user_contact', but I had missed some of the necessary changes, and I'm completing them now.

Test out which situations the links don't work - I have a user with admin privileges, and he can add and see all links properly, so I'm not sure what the problem is.

jkwalnut
12-02-05, 03:27 PM
Ok, tried again with a fresh database & cvs update of dotproject & links module.

I've got 2 users, the admin and test_user.

The test_user is allowed all permissions to all_modules, admin_modules, & links_module. The test_user can add links but NOT view them.

If I login as admin I can see all the links created by test_user. The admin is allowed all permissions to all_modules & admin_modules.

Let me know if I should check anything else, I've also removed and installed once more, but no changes.

Are the following lines still needed in view.php as the readme states?

$showProject = false;
$tabBox->add(dPgetConfig('root_dir')."/modules/links/index_table",'Links');

Thanks.

cyberhorse
12-02-05, 05:17 PM
No, these lines shouldn't be needed as the tabs should be automatically loaded now.

so in terms of permissions what is the difference between the admin and test_user? My main user is with similar (if not the same) permissions, and sees created links ...

perhaps try giving permissions to user_modules
also try to uninstall and reinstall the links module, as there are some problems with the permissions system and custom modules, which are fixed somewhat after reinstall of modules.

jkwalnut
13-02-05, 02:00 AM
I've tried the following combinations with test_user:

all permissions
all, & admin permissions (similar to working admin account)
all, admin, & links permissions
admin & non-admin permissions

I've tried various remove/install/re-permission steps with no luck.

Maybe I'm installing incorrectly? You need to execute dotproject.sql & upgrade_permissions.sql, right?

cyberhorse
14-02-05, 02:49 PM
that's right ...
if you have a chance, can you try something else - install 1.0.2, add a new user with admin privileges, upgrade to 2.0alpha (discussed how to in current cvs topic), reinstall links module, add permissions to that new user for links module

jkwalnut
27-02-05, 11:40 AM
I went back to v102 and used the links version that was modified by pedroa.

as in : http://www.dotproject.net/index.php?name=PNphpBB2&file=viewtopic&t=1963

Everything is working as expected.

The setup.php for the links module is hardcoded for the database 'dotproject'. That was the only issue i encountered since I have v102 & 20alpha databases.

pedroa
28-02-05, 10:52 AM
Hi jkwalnut, I am glad that someone had use for the update :).

Now, talking about your problem with 2.0, let me tell that I am so much used to logging as administrator that I haven't noticed that users rather than the one I use to log, were unable to see even their links.

The problem resides in the permissions table, and to tell the truth I don't even know why does it exist since permissons are treated trough phpgacl, isn't it so Cyberhorse?

Well links for 2.0 needs the permissions table if you see the sql on index_table.php, it is here that this problem arise.

Workaround:
1) Goto phpmyadmin (if you don't have it, get it), point to your db, to the users table, write down the user_id you want to grant view.
2) Still in phpmyadmin go to the permissions table, browse the tables records, I expect you only see one record, and that's the admin's one (that's why you can see the Links when logged has the primary administrator). Write down the number of the next permission_id, i guess it will be 2. Now insert a new record, with values:
permission_id: 2 (I guess it is 2 but should be 1 more than the higher value for this field)
permission_user: 2 (I guess it is 2 because this is the next user_id after the primary administrator)
permission_grant_on: all (I don't know if this affects other modules but grant'em all just in case)
permission_item: -1 (all items I guess, copied from primary administrator)
permission_value: -1 (true I guess, copied from primary administrator)
Execute the insertion.

Now if you try the Links module, user number 2 (whoever he is) will be able to view links.

The permission system in dotproject is complex and there is the need for the developers to rearrange this for ver 2.0 Links module.

Pedro A.

ajdonnison
28-02-05, 02:04 PM
It would be much easier if the v2.0 permissions semantics were adhered to, at least in a v2.0 compatible version. Something like the following would work:

@include_once $dPconfig['root_dir'] . '/includes/version.php';
if (isset($dp_version_major) && $dp_version_major >= 2) {
// Use new style permissions.
$perms =& $AppUI->acl();
$canRead = $perms->checkModule($m, 'view');
} else {
// Use old style permissions.
}

pedroa
28-02-05, 07:57 PM
ajdonnison, you are right, that should be the right way to go.

Only thing to point is that the permissions issue on the Links module (at least in the version of the cvs I am using, don't know if the most recent cvs was changed in the meanwhile) is hardcoded in $sql variable. This should be removed and the $sql reformulated accordingly.

By the way thanks for your information, it will surely help me.

Pedro A.

cyberhorse
01-03-05, 12:10 AM
will be fixed as soon as I have time to look at it