Commit 040b0a5b authored by claes's avatar claes

*** empty log message ***

parent 5c45bcff
!
! Proview $Id: wb_pwrs_msg.msg,v 1.3 2005-09-01 14:58:00 claes Exp $
! Proview $Id: wb_pwrs_msg.msg,v 1.4 2008-06-24 07:40:16 claes Exp $
! Copyright (C) 2005 SSAB Oxelsund AB.
!
! This program is free software; you can redistribute it and/or
......@@ -45,6 +45,8 @@ posattribute <an attribute or buffer object should be child to a ObjBodyDef obje
posobjbodydef <a body object should be child to a ClassDef object> /error
moveattribute <an attribute object can only be moved within the same childhood> /error
movebody <a body object can only be moved within the same childhood> /error
possecurity <a Security object should be a child to a $Node object> /error
securityalrex <a security object already exist> /error
......
/*
* Proview $Id: wb_c_security.cpp,v 1.1 2008-06-24 07:42:58 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
/* wb_c_security.c -- work bench methods of the $Security class. */
#include <string.h>
#include "wb_pwrs.h"
#include "wb_pwrs_msg.h"
#include "wb_ldh.h"
static pwr_tStatus AnteCreate (
ldh_tSesContext Session,
pwr_tObjid Father,
pwr_tClassId Class
) {
pwr_tCid cid;
pwr_tStatus sts;
pwr_tOid oid;
// ClassHier should be child to a $Node object
if ( Father.oix == 0)
return PWRS__POSSECURITY;
sts = ldh_GetObjectClass( Session, Father, &cid);
if ( EVEN(sts)) return sts;
if ( cid != pwr_eClass_Node)
return PWRS__POSSECURITY;
// There should only be one security object
sts = ldh_GetClassList( Session, pwr_eClass_Security, &oid);
if ( ODD(sts))
return PWRS__SECURITYALREX;
return PWRS__SUCCESS;
}
static pwr_tStatus AnteMove (
ldh_tSesContext Session,
pwr_tObjid Object,
pwr_tObjid Father,
pwr_tObjid OldFather
) {
// Check that that the father is the same
if ( !(Father.oix == OldFather.oix && Father.vid == OldFather.vid))
return PWRS__POSSECURITY;
return PWRS__SUCCESS;
}
static pwr_tStatus PostCreate (
ldh_tSesContext Session,
pwr_tObjid Object,
pwr_tObjid Father,
pwr_tClassId Class
) {
pwr_tStatus sts;
// Set name to Security
sts = ldh_SetObjectName( Session, Object, "Security");
if ( EVEN(sts)) return sts;
return PWRS__SUCCESS;
}
pwr_dExport pwr_BindMethods($Security) = {
pwr_BindMethod(AnteCreate),
pwr_BindMethod(AnteMove),
pwr_BindMethod(PostCreate),
pwr_NullMethod
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment