Access denied

Discussion forum about Anuko Time Tracker
dell810
Posts: 42
Joined: Sat Oct 01, 2016 1:09 pm

Access denied

Post by dell810 » Mon May 28, 2018 2:43 pm

Hi,
I'm trying to update from 1.9.34 to 1.17.89.4271 & I'm following all the steps from the tutorial.
As Admin user I can log in but as user I can't = message "Access denied" (on the header dispaly "Logout", so I', logged in, but I can't see any page content).

Please any help?
Thanks a lot

wrc
Posts: 259
Joined: Tue May 25, 2010 8:30 pm

Re: Access denied

Post by wrc » Tue May 29, 2018 1:15 pm

Did you update the roles during migration (there is a button for that in deinstall.php in one step). Unfortunately, it works only for a specific version of the db schema, so if the step is missed, and the schema is updated (and the role field is therefore, dropped), then you may have to update the role_id in the tt_users table directly.

Try to login is team manager, does this work? If this works, then go to Users page and see if all users have proper roles. If some of them do not have roles assigned and you see "Access denied" when trying to edit such users, you may need to manipulate the role_id in MySQL database or open a support incident.

dell810
Posts: 42
Joined: Sat Oct 01, 2016 1:09 pm

Re: Access denied

Post by dell810 » Tue May 29, 2018 5:48 pm

Hi wrc,
I'm not sure which version I had because I had deleted version of Time Tracker from page footer and started my version from 1.0.
Should I perform all the steps (from top to bottom) because I'm not sure about the version ?

Today I downloaded version 1.17.22.3998.
...................................................................................
By executing dbinstall.php:
Environment Checks
WEB-INF/templates_c/ directory is writable.
WEB-INF/config.php file exists.
DSN is defined.
PHP version: 7.2.3, good enough.
mysqli PHP extension is loaded.
mbstring PHP extension is loaded.
gd PHP extension is loaded.
Connection to database successful.
There are 21 tables in database.
Error: database schema version query failed. MDB2 Error: no such table
...................................................................................
1. Do you mean "Did you update the roles ..." => I've update via Update database structure (v1.14 to v1.17.44) = "Update role_id"
2. I tried to login as team manager and team manager normally logged in, but do not show his employees in the reports

Now, I can't login neither as admin.

By pressing "Update database structure (v1.17.44 to v1.17.88)" I noticed that the table tt_users is deleted and roles are lost in the table tt_users (client_id = NULL for ALL)
Thanks

wrc
Posts: 259
Joined: Tue May 25, 2010 8:30 pm

Re: Access denied

Post by wrc » Wed May 30, 2018 3:20 pm

dell810 wrote:
Tue May 29, 2018 5:48 pm
Today I downloaded version 1.17.22.3998.
The latest as of now is 1.17.89.4271, not 1.17.22.3998. If you need revamped roles working, it's best to use the latest.

dell810 wrote:
Tue May 29, 2018 5:48 pm
Error: database schema version query failed. MDB2 Error: no such table
dbinstall.php seems out of sync, as there is no database version check in 1.17.22.3998. I suspect dbinstall.php is from a later version and the error in the end is normal for 1.17.22 database.

dell810 wrote:
Tue May 29, 2018 5:48 pm
1. Do you mean "Did you update the roles ..." => I've update via Update database structure (v1.14 to v1.17.44) = "Update role_id"
Yes, but if you intend to use 1.17.22.3998 this is not relevant at all.

dell810 wrote:
Tue May 29, 2018 5:48 pm
By pressing "Update database structure (v1.17.44 to v1.17.88)" I noticed that the table tt_users is deleted and roles are lost in the table tt_users (client_id = NULL for ALL)

The step "Update database structure (v1.17.44 to v1.17.88)" should not be in dbinstall.php for version 1.17.22 (if this is what you try to use). There is no code in dbinstall.php that drops tt_users table. client_id being NULL is normal if you are not using the Clients plugin.

I suggest starting from backup and trying to do the update to whatever version you want, properly. If you see issues, let us know what they are.

dell810
Posts: 42
Joined: Sat Oct 01, 2016 1:09 pm

Re: Access denied

Post by dell810 » Wed May 30, 2018 4:00 pm

Hi WRC,
I'm sorry for the questions, I'm a beginner...
Now I've the latest 1.17.89.4271 (Time Tracker with PDF reports)

1. Should I perform all the steps (from top to bottom) because I'm not sure which is the the existing (old) version ?
Which buttons must be choose?
capture.png
capture.png (35.61 KiB) Viewed 2968 times
2. dbinstall.php from the version return:
PHP version: 7.2.3, good enough.
mysqli PHP extension is loaded.
mbstring PHP extension is loaded.
gd PHP extension is loaded.
Connection to database successful.
There are 21 tables in database.
Error: database schema version query failed. MDB2 Error: no such table

3. The step "Update database structure (v1.17.44 to v1.17.88)" is exists.
I don't know which buttons must choose to update.

Thanks again

wrc
Posts: 259
Joined: Tue May 25, 2010 8:30 pm

Re: Access denied

Post by wrc » Wed May 30, 2018 5:00 pm

dell810 wrote:
Wed May 30, 2018 4:00 pm
1. Should I perform all the steps (from top to bottom) because I'm not sure which is the the existing (old) version ?
Which buttons must be choose?
No, don't do all the steps. As some steps do some additional stuff in addition to updating the DB stricture (Update projects, etc.) which may mess things up.

Start with a working backup.

If backup does not exists, create one now (both db and code) - it may help to fix any future problems if upgrade fails (which is likely if you use customized code).

Assuming you start from a relatively recent version (such as 1.6), try these:

- Update database structure (v1.6 to v1.14)
- Then Update database structure (v1.14 to v1.17.44)
- Then Update role_id in the same step.
- Then Update database structure (v1.17.44 to v1.17.88)

prx
Posts: 5
Joined: Tue Jun 05, 2018 11:16 am

Re: Access denied

Post by prx » Tue Jun 05, 2018 11:18 am

I Have the same issue. I upgraded from 1.9 to 1.13 without any issues. But When i upgrade from 1.13 to the 1.17.88 i am not able to see roles anymore and also not able to create , edit etc users and their timesheets.

admin
Posts: 547
Joined: Fri Oct 08, 2004 9:46 pm
Location: Vancouver, Canada
Contact:

Re: Access denied

Post by admin » Wed Jun 06, 2018 12:41 pm

prx wrote:
Tue Jun 05, 2018 11:18 am
When i upgrade from 1.13 to the 1.17.88 i am not able to see roles anymore and also not able to create , edit etc users and their timesheets.
Was the "Update role_id" step done?

Look in the tt_users table for role_id value for your users. Is it assigned (not null)? If null then either "Update role_id" step was either not done, not done in proper sequence, or we have a bug, which is also likely, as the issues surfaced up multiple times already.

To fix the problem manually one will need to assign a proper role id to each user.

prx
Posts: 5
Joined: Tue Jun 05, 2018 11:16 am

Re: Access denied

Post by prx » Wed Jun 06, 2018 1:16 pm

If i execute Update role_id it gives me 0 roles updated. I think that table is not updated propperly.

Also if i check tt_roles i can only see Site Administrator and Top Manager as a role.

Only 1 user has a role_id 2 which is a Top Manager. All others have NULL for role_id

I did the update from 1.9 to 1.13 again and i see that the new user/role tables are not implemented. This update causes no errors. if i update then to the latest 1.17 version (both pdf and normal), it corrupts my dbase and it gives me access denied errors.

jbourne
Posts: 2
Joined: Wed Jun 06, 2018 9:02 pm

Re: Access denied

Post by jbourne » Thu Jun 07, 2018 3:11 pm

We had the same problem.

The upgrade did migrate the users but did not migrate any roles. I had to manually add and assign roles then it started working correctly.

Jim

jbourne
Posts: 2
Joined: Wed Jun 06, 2018 9:02 pm

Re: Access denied

Post by jbourne » Thu Jun 07, 2018 3:14 pm

Additionally, we upgraded from 1.12.2.3683.

wrc
Posts: 259
Joined: Tue May 25, 2010 8:30 pm

Re: Access denied

Post by wrc » Thu Jun 07, 2018 3:50 pm

Unfortunately, the "Update role_id it" is database schema specific, and will only work when executed as expected, for db schema version 1.17.44 (not after the fact when the schema is already updated to a more recent version). This is because fields have been either changed or dropped and at least one table was renamed.

Examples of issues that may surface up:
1) "inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.17.44')" - the update query requires db version 1.17.44 to work.
2) tt_teams is now tt_groups.
3) team_id field is now called group_id.
4) Legacy role field is dropped from tt_users.

Perhaps it is best to fix the missing role_id manually like so:

- Determine group id for the group (the value of group_id column in tt_users table).
- See if roles are created for the group already. Assuming group_id is 1:

Code: Select all

select * from tt_roles where group_id = 1;
The above would normally return a set of 5 predefined roles (User, Supervisor, Client, Co-manager, and Manager). Note their id, specifically for the User role.

Now use this id and set role_id field in tt_users for a user that has a NULL role_id. This should get you around the Access denied issue.

If predefined roles are not yet created, they need to be created, but I need to research further how this could be done.

Nik
Posts: 447
Joined: Wed May 26, 2010 5:55 pm

Re: Access denied

Post by Nik » Fri Jun 08, 2018 4:43 pm

There is a bug in ttRoleHelper::createPredefinedRoles, which seems to be the reason why "Update role_id" fails. I am going to look into this today and hopefully fix it.

What seems to be happening is that roles are not getting created, and therefore, we cannot assign any roles during an update.

The root cause is an invalid field name (group_id, not team_id).

Nik
Posts: 447
Joined: Wed May 26, 2010 5:55 pm

Re: Access denied

Post by Nik » Fri Jun 08, 2018 5:21 pm

Nik wrote:
Fri Jun 08, 2018 4:43 pm
There is a bug in ttRoleHelper::createPredefinedRoles, which seems to be the reason why "Update role_id" fails. I am going to look into this today and hopefully fix it.
I fixed the "Update role_id" step in version 1.17.90.4272 (hopefully). Apparently, more testing is required, as things do not appear stable at the moment.

The changes I made:

1) Introduced createPredefinedRoles_1_17_44 and getRoleByRank_1_17_44 functions in ttRoleHelper class to be used during database schema update.
2) Changed dbinstall.php (the Update role_id" step) to use these functions.

I hope it helps for new migrations.

prx
Posts: 5
Joined: Tue Jun 05, 2018 11:16 am

Re: Access denied

Post by prx » Wed Jun 13, 2018 6:27 am

The fix by Nik did the Trick :).

My issue is solved and i am now able to upgrade without any issues so far. I will continue with testing upcoming days. If anything pops up i will makes sure to report it here.

What a great community and forum!

Thanks a lot guys!

Regards!

Post Reply