Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: [Solved]: PHP for giving a group permission to an album?  (Read 5307 times)

0 Members and 1 Guest are viewing this topic.

ajbarickman

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
[Solved]: PHP for giving a group permission to an album?
« on: October 21, 2009, 02:36:26 pm »

Hello,

I have modified the timer.php script to batch upload a lot of photos at one time and create albums. I now need to add groups to each of these uploaded albums as part of the script. Can anyone point me in the right direction?

Thank you,
AB
« Last Edit: December 07, 2009, 08:32:31 am by Joachim Müller »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: PHP for giving a group permission to an album?
« Reply #1 on: October 21, 2009, 03:08:21 pm »

  • Where should the group data come from?
  • What are your modifications of timer.php?
  • What's the URL of your gallery?

In the end you just run three queries against the database: first you read if a particular group already exists; if no you run the second query to create the group. In the thrid query you assign permission to the particular album.

Setting a lot of different permissions by album can be an issue for large galleries because of the query load. I suggest explaining what you actually want to accomplish - maybe someone has got a batter idea.

There can be no generic answer to your question. You always need to be more specific.

There is a reason why we ask per board rules for your gallery URL in each support request. If you expect answers you should respect rules...
Logged

ajbarickman

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: PHP for giving a group permission to an album?
« Reply #2 on: October 21, 2009, 03:27:19 pm »

Joachim, I assume it's because English is not your first language and you don't mean anything by it but your response was unnecessarily snide.  Here is the information that you requested.

Here is a link to the development gallery which does not have any relevance in this question therefore was not included in the original post. --> http://nivlek.org/aanddcm/

I have modified the timer.php in the following ways:
- Eliminate the default creation of categories and just create albums that are not in any categories.
- Made it not require any inputs to run. I pass in the required parameters via query_string so that I can run the script using a cron job.
- Added some additional logging information to make it more clear what has occurred
- Do an auto-login as admin, again so that I can run it as a cron job (yes I know it's a security risk)

As timer.php creates an album I need to assign a specific group to have permissions to it (same as going to the UI and setting it using 'Album can be viewed by'). So album1 should have group Y assigned to it.

I assume there is no documentation about which tables are used for which things. I guess I would like to be able to know which table/tables are used to store group, album and permissions information. Is there a way to know without posting here?

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: PHP for giving a group permission to an album?
« Reply #3 on: October 21, 2009, 03:39:43 pm »

The preliminary documentation for cpg1.5.x contains a section about the database tables and what they're used for. For your purposes, the information should apply for cpg1.4.x as well.
Check http://documentation.coppermine-gallery.net/en/dev_database.htm
Logged

ajbarickman

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: PHP for giving a group permission to an album?
« Reply #4 on: October 21, 2009, 03:42:08 pm »

That is great. Thanks.
Logged

ketil

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
    • video clip downloads
Re: PHP for giving a group permission to an album?
« Reply #5 on: December 07, 2009, 01:40:56 am »

Yep, the DB documentation is really useful for integration with other services as well, then I don't have to guess. Cheers for that!
Logged
Pages: [1]   Go Up
 

Page created in 0.024 seconds with 19 queries.