changed: the way of building the cmslu
main Makefile is in an application directory in cmslu/ there are only libraries: core.a content.a confparser.a templates.a added: macros APPTEMPLATES APPFUNCTIONS defined in the application's Makefile added: PatternCacher added: cmslu function 'run' files which have exec permissions can be run (run is a default function) after read from the database the content is parsed into Ezc::Pattern object, this object is then cached in PatternCacher added: FunctionCodeParser - will be used to parse the code from standard functions (ls/cat/...) git-svn-id: svn://ttmath.org/publicrep/cmslu/trunk@475 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
83
content/priv.cpp
Executable file
83
content/priv.cpp
Executable file
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* This file is a part of CMSLU -- Content Management System like Unix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2008, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "content.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::PostFunPriv()
|
||||
{
|
||||
// !! narazie tylko dla plikow
|
||||
if( !request.is_item )
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
long user_id = data.users.GetUserId( request.PostVar("user") );
|
||||
long group_id = data.groups.GetGroupId( request.PostVar("group") );
|
||||
int privileges = strtol( request.PostVar("privileges").c_str() , 0, 8);
|
||||
|
||||
if( !request.CanChangeUser(request.item, user_id) )
|
||||
throw Error(Error::cant_change_user);
|
||||
|
||||
if( !request.CanChangeGroup(request.item, group_id) )
|
||||
throw Error(Error::cant_change_group);
|
||||
|
||||
if( !request.CanChangePrivileges(request.item, privileges) )
|
||||
throw Error(Error::cant_change_privileges);
|
||||
|
||||
request.item.user_id = user_id;
|
||||
request.item.group_id = group_id;
|
||||
request.item.privileges = privileges;
|
||||
|
||||
request.session->done = Done::privileged_item;
|
||||
request.session->done_status = db.EditPrivById(request.item, request.item.id);
|
||||
}
|
||||
catch(const Error & e)
|
||||
{
|
||||
log << log1 << "Content: FunChmod: Error: " << e << logend;
|
||||
request.session->done_status = e;
|
||||
}
|
||||
|
||||
if( request.session->done_status == Error::ok )
|
||||
{
|
||||
request.session->item = request.item;
|
||||
request.session->done_timer = 2;
|
||||
RedirectTo(request.item);
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Content: PostFunPrivileges: Error: " << static_cast<int>(request.session->done_status) << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void Content::FunPriv()
|
||||
{
|
||||
if( !request.is_item )
|
||||
{
|
||||
// !! chwilowi tylko dla plikow
|
||||
request.status == Error::item_required;
|
||||
return;
|
||||
}
|
||||
|
||||
// you must be an owner of the item (or a superuser)
|
||||
// !! moze wykorzystac request.CanChangeUser() ?
|
||||
if( !request.session->puser || (!request.session->puser->super_user && request.session->puser->id != request.item.user_id) )
|
||||
{
|
||||
request.status = Error::permision_denied;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user