FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
local function of delagent More...
#include <crypt.h>
#include "delagent.h"
Go to the source code of this file.
Functions | |
int | printfInCaseOfVerbosity (const char *format,...) |
If verbose is on, print to stdout. More... | |
PGresult * | PQexecCheck (const char *desc, char *SQL, char *file, const int line) |
simple wrapper which includes PQexec and fo_checkPQcommand for queries without result More... | |
PGresult * | PQexecCheckResult (const char *desc, char *SQL, char *file, const int line) |
simple wrapper which includes PQexec and fo_checkPQresult for queries with result More... | |
void | PQexecCheckClear (const char *desc, char *SQL, char *file, const int line) |
Execute SQL query and create the result. More... | |
int | authentication (char *user, char *password, int *userId, int *userPerm) |
if this account is valid More... | |
int | check_permission_upload (int wanted_permissions, long uploadId, int userId, int userPerm) |
check if the upload can be deleted, that is the user have the permission to delete this upload More... | |
int | check_read_permission_upload (long uploadId, int userId, int userPerm) |
check if the user has read permission on the given upload More... | |
int | check_write_permission_upload (long uploadId, int userId, int userPerm) |
check if the user has read permission on the given upload More... | |
int | check_write_permission_folder (long folder_id, int userId, int userPerm) |
check if the upload can be deleted, that is the user have the permission to delete this upload More... | |
int | check_write_permission_license (long license_id, int userPerm) |
check if the license can be deleted, that is the user have the permission to delete this license More... | |
int | deleteUpload (long uploadId, int userId, int userPerm) |
Given an upload ID, delete it. More... | |
int | unlinkContent (long child, long parent, int mode, int userId, int userPerm) |
remove link between parent and (child,mode) if there are other parents More... | |
int | listFoldersRecurse (long Parent, int Depth, long Row, int DelFlag, int userId, int userPerm) |
Draw folder tree. More... | |
int | listFoldersFindDetatchedFolders (PGresult *result, int userId, int userPerm) |
Given a PGresult, find detached folders. More... | |
int | listFoldersFindDetatchedUploads (PGresult *result, int userId, int userPerm) |
Given a PGresult, find detached uploads. More... | |
int | listFoldersFindDetatched (int userId, int userPerm) |
Given a user id, find detached folders and uploads. More... | |
int | listFolders (int userId, int userPerm) |
List every folder. More... | |
int | listUploads (int userId, int userPerm) |
List every upload ID. More... | |
int | deleteFolder (long cFolder, long pFolder, int userId, int userPerm) |
recursively delete a folder More... | |
int | readAndProcessParameter (char *Parm, int userId, int userPerm) |
Parse parameters. More... | |
void | doSchedulerTasks () |
process the jobs from scheduler More... | |
void | exitNow (int exitVal) |
Exit function. This does all cleanup and should be used instead of calling exit() or main() return. More... | |
Variables | |
int | Verbose = 0 |
Verbose level. More... | |
int | Test = 0 |
int | Scheduler = 0 |
PGconn * | pgConn = NULL |
Database connection. More... | |
local function of delagent
delagent: Remove an upload from the DB and repository
Definition in file util.c.
int authentication | ( | char * | user, |
char * | password, | ||
int * | userId, | ||
int * | userPerm | ||
) |
if this account is valid
[in] | user | user name |
[in] | password | password |
[out] | userId | will be set to the id of the user |
[out] | userPerm | will be set to the permission level of the user |
get user_seed, user_pass on one specified user
int check_permission_upload | ( | int | wanted_permissions, |
long | uploadId, | ||
int | userId, | ||
int | userPerm | ||
) |
int check_read_permission_upload | ( | long | uploadId, |
int | userId, | ||
int | userPerm | ||
) |
int check_write_permission_folder | ( | long | folder_id, |
int | userId, | ||
int | userPerm | ||
) |
int check_write_permission_license | ( | long | license_id, |
int | userPerm | ||
) |
int check_write_permission_upload | ( | long | uploadId, |
int | userId, | ||
int | userPerm | ||
) |
int deleteFolder | ( | long | cFolder, |
long | pFolder, | ||
int | userId, | ||
int | userPerm | ||
) |
recursively delete a folder
Given a folder ID, delete it AND recursively delete everything below it! This includes upload deletion!
cFolder | the folder id to delete |
pFolder | parent of the current folder |
userId | |
userPerm | permission level the user has |
int deleteUpload | ( | long | uploadId, |
int | userId, | ||
int | userPerm | ||
) |
void doSchedulerTasks | ( | ) |
process the jobs from scheduler
void exitNow | ( | int | exitVal | ) |
int listFolders | ( | int | userId, |
int | userPerm | ||
) |
int listFoldersFindDetatched | ( | int | userId, |
int | userPerm | ||
) |
int listFoldersFindDetatchedFolders | ( | PGresult * | result, |
int | userId, | ||
int | userPerm | ||
) |
int listFoldersFindDetatchedUploads | ( | PGresult * | result, |
int | userId, | ||
int | userPerm | ||
) |
int listFoldersRecurse | ( | long | Parent, |
int | Depth, | ||
long | Row, | ||
int | DelFlag, | ||
int | userId, | ||
int | userPerm | ||
) |
Draw folder tree.
if DelFlag is set, then all child uploads are deleted and the folders are deleted.
Parent | the parent folder id |
Depth | |
row | grandparent (used to unlink if multiple grandparents) |
DelFlag | 0=no del, 1=del if unique parent, 2=del unconditional |
userId | |
userPerm | permission level the user has |
int listUploads | ( | int | userId, |
int | userPerm | ||
) |
PGresult* PQexecCheck | ( | const char * | desc, |
char * | SQL, | ||
char * | file, | ||
const int | line | ||
) |
void PQexecCheckClear | ( | const char * | desc, |
char * | SQL, | ||
char * | file, | ||
const int | line | ||
) |
Execute SQL query and create the result.
PGresult* PQexecCheckResult | ( | const char * | desc, |
char * | SQL, | ||
char * | file, | ||
const int | line | ||
) |
int printfInCaseOfVerbosity | ( | const char * | format, |
... | |||
) |
int readAndProcessParameter | ( | char * | Parm, |
int | userId, | ||
int | userPerm | ||
) |
Parse parameters.
Read Parameter from scheduler. Process line elements.
Parm | the parameter string |
userId | |
userPerm | permission level the user has |
Get the type of command: delete or list
Get the target
int unlinkContent | ( | long | child, |
long | parent, | ||
int | mode, | ||
int | userId, | ||
int | userPerm | ||
) |
remove link between parent and (child,mode) if there are other parents
child | id of the child to be unlinked |
parent | id of the parent to unlink from |
mode | 1<<0 child is folder_fk, 1<<1 child is upload_fk, 1<<2 child is an uploadtree_fk |
userPerm | permission level the user has |