adding user to administer bookings in an existing calendar

Help with installation and general calendar setttings

adding user to administer bookings in an existing calendar

Postby krejt » Thu Apr 01, 2010 10:06 pm

Chris,

In version 3.01 you added a special admin user to allow individual users to be added with permission to administrate their own calendars but NOT the general calendar details (states etc).

I want to add a new user which should be able to administer the bookings in an already existing calendar; a calendar I created with the admin account. Is this possible?

I created a new user, and I see that the new user can add new booking items, and has the option to specify an Extern Item ID to reference to an existing items database table, but that isn't the solution, is it?

Tjerk.
krejt
 
Posts: 14
Joined: Sun Mar 28, 2010 12:54 am

Re: adding user to administer bookings in an existing calend

Postby chris » Sat Apr 03, 2010 11:51 am

I want to add a new user which should be able to administer the bookings in an already existing calendar; a calendar I created with the admin account. Is this possible?

Do you need this user for just one particular calendar or all the calendars?

If you simply want to have another user with top-level admin you just need to manually update their level in the "bookings_admin_users" database table and set the field "level" to "1" rather than the default "2" that is assigned to all new users.
Basically users with level "1" have complete control of the calendar all the calendars, items, bookings and states. Level "2" can only view and modify their own calendars.

Ideally I should add this possibility to the user admin panel and will do so for the next version (the list of things to do is getting longer :( ). However, if you want, I can post the necessary changes here, it will only be a few lines of code.

I hope this is clear :)

I created a new user, and I see that the new user can add new booking items, and has the option to specify an Extern Item ID to reference to an existing items database table, but that isn't the solution, is it?

No, this field really serves no practical purpose "as is". This field is there so that you can associate the calendar "items" with already existing items in other database tables. In practices it's implementation requires specific php code (ie can't be generic and is therefore not included) to be of any use.

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: adding user to administer bookings in an existing calend

Postby krejt » Sat Apr 03, 2010 8:33 pm

Thanks for your clear replies Chris! I understand the 'Item ID' answer.

Let me explain my question about the additional user a bit more. What I need is a way to give my parents access to the 'Bookings' tab (and the Bookings tab alone) of an existing calendar; a calendar I created with my admin account. They shouldn't be able to add or modify any calendars or settings, apart from changing the booking status (booked, provisional, ..) of the calendar(s) they have access to.

I realize this question might lead to a full blown rights management interface...

For the moment giving them level 2 access with their own account to my calendar (a calendar created and configured by admin) will suffice. Or is that too difficult?

Tjerk.

Ps. There is a 'Add Item' button on the Bookings tab that probably shouldn't be there? That function is already available (and belonging) on the 'Booking Items' tab.
krejt
 
Posts: 14
Joined: Sun Mar 28, 2010 12:54 am

Re: adding user to administer bookings in an existing calend

Postby chris » Sat Apr 03, 2010 9:00 pm

Is it "just" your parents who need access and will be using this? or do you have other calendars and users?

If it is just this one-off case, you could hack to code to remove the limit as to what calendar items can be seen and edited.

Show bookings
1. Open "ac-admin" > "index.php" file on line 79.
2. Find and comment out or remove this line:
Code: Select all
if($_SESSION["admin_level"]>1)   $sql_condition=" AND b.id_user=".$_SESSION["admin_id"];

That line of code simply limits the booking items that can be seen and modfied.

Remove the "items" option from the menu.
1. Open "ac-admin" > "admin-menu.inc.php"
2. FInd and comment out or remove this line (ln 19):
Code: Select all
$menu[2]["local"]["items"]   = array('href'=>'','txt'=>''.$lang["admin_items"].'','icon'=>'');

That will simply remove it from the menu for this level user.

Ps. There is a 'Add Item' button on the Bookings tab that probably shouldn't be there? That function is already available (and belonging) on the 'Booking Items' tab.

It is there so as to enable users to quickly add a new item without having to open the "Items" option and then "add new item". Clearly you will have to remove this in your particular case.

I hope I got it right this time ;)
Let me know how it goes or if you have any problems.

Chris
User avatar
chris
Site Admin
 
Posts: 1089
Joined: Mon Dec 17, 2007 7:42 pm
Location: Málaga, Spain

Re: adding user to administer bookings in an existing calend

Postby krejt » Sat Apr 03, 2010 11:11 pm

Hello Chris,

It is just this one-off case; I have only one calendar and only my parents to deal with ;-)

With the info you provided I should be able to hack the code to remove the limit as to what calendars and menu's can be seen and edited. You got it perfectly right!

Thanks a lot,
Tjerk.
krejt
 
Posts: 14
Joined: Sun Mar 28, 2010 12:54 am

Re: adding user to administer bookings in an existing calend

Postby krejt » Sat Apr 03, 2010 11:55 pm

That worked perfect! No problems at all. Thanks again,
Tjerk.
krejt
 
Posts: 14
Joined: Sun Mar 28, 2010 12:54 am

Re: adding user to administer bookings in an existing calend

Postby Garfield » Sun May 02, 2010 12:29 am

I realize it's an "old" topic, but just to see if I got the users problem and understand your code ;) .

Why not lookup the field id in the table bookings_admin_users for the user you created for your parents.

And then change the field id_user in the table bookings_items to this value.

As a result it will look as your parents their user account created this calendar, giving them access to it.
And as you have an admin account you can also still access this calendar.
Garfield
 
Posts: 4
Joined: Fri Apr 30, 2010 2:44 pm

Re: adding user to administer bookings in an existing calend

Postby Zen » Thu May 19, 2011 1:33 am

An old thread I know, but, having had a similar requirement, it may help others to know that in addition to the guidance provided by Chris on Sat Apr 03, I found the following additional 2 actions worthwhile:

1. In "ac-admin" open "index.php" file on line 84.
2. Find and comment out or remove this line:
Code: Select all
$the_file=AC_DIR_ADMIN."forbidden.admin.php";

(suppresses an error message)


1. In "ac-admin" open "bookings.admin.php" file on line 61 to 63.
2. Find and comment out or remove these lines:
Code: Select all
</td>
<td>&nbsp;&nbsp;</td>
<td><input type="button" value="'.$lang["bt_add_item"].'" style="" onclick="document.location.href=\'index.php?page=items&action=new\'"></td>

(removes the button that links to the 'add booking items' page)


Zen
Zen
 
Posts: 3
Joined: Thu May 19, 2011 1:17 am

Re: adding user to administer bookings in an existing calend

Postby srelliott » Fri Jul 08, 2011 8:05 pm

Zen,

Thanks for the tip on how to remove the error message. Does anyone know how to change default selected menu. As of now, when I log in as a user (not admin) I no longer see the "Booking Items" button and only see the "Bookings" button, but I'm dropped off onto a blank page. I have to click bookings to see the bookings.

How can I make it so users are automatically defaulted to the Bookings page?
srelliott
 
Posts: 11
Joined: Thu Jul 07, 2011 10:28 pm

Re: adding user to administer bookings in an existing calend

Postby srelliott » Fri Jul 08, 2011 8:09 pm

srelliott wrote:How can I make it so users are automatically defaulted to the Bookings page?


I found that if change line 58

elseif(!isset($_REQUEST["page"])) $_REQUEST["page"]="bookings";

It does this, but it also does this for admin, not that big of a deal, but would be nice if you could affect only users and not admin.

Also, changing this then no longer requires you to comment out line 84 to get rid of the error message as Zen mentioned.
srelliott
 
Posts: 11
Joined: Thu Jul 07, 2011 10:28 pm

Next

Return to Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron