[Solved]: PHP for giving a group permission to an album? [Solved]: PHP for giving a group permission to an album?
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

[Solved]: PHP for giving a group permission to an album?

Started by ajbarickman, October 21, 2009, 02:36:26 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ajbarickman

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

Joachim Müller


  • 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...

ajbarickman

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?


Joachim Müller

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

ajbarickman


ketil

Yep, the DB documentation is really useful for integration with other services as well, then I don't have to guess. Cheers for that!