<Column name="roomid" type="string:64" primarykey="yes">Name of the room</Column>
<Column name="capacity" type="int32" notnull="yes">Amount of people fitting into the room, zero means unlimited, this can be overridden per event.</Column>
<Column name="description" type="text">A short description of the room to help users. Currently not used extensively.</Column>
+ <Column name="flags" type="string">filter flags: defines who can use this room for new events (ignored once it is attached to an event)</Column>
</Table>
<Table name="seatplan" backup="yes">
+ <Doc>stores seating arrangements</Doc>
<Column name="seatplanid" type="seq32" primarykey="yes"/>
- <!-- display name -->
- <Column name="name" type="string"/>
- <!-- XML form of the plan -->
- <Column name="plan" type="text"/>
+ <Column name="roomid" type="string:64" foreignkey="room:roomid">the room this seating arrangement belongs to</Column>
+ <Column name="name" type="string">display name of the seating arrangement</Column>
+ <Column name="plan" type="text">XML representation of the seating arrangements</Column>
+ <Column name="flags" type="string">filter flags: defines who can use this arrangement for new events (ignored once it is attached to an event)</Column>
</Table>
<Table name="pricecategory" backup="yes">
<Column name="name" type="string" notnull="yes"/>
<Column name="abbreviation" type="string:10" notnull="yes"/>
<Column name="formula" type="string"/>
- <Column name="flags" type="string"/>
+ <Column name="flags" type="string">filter flags: defines who can use the category to define a new event (ignored once it is attached to an event)</Column>
<Preset>
<V col="pricecategoryid" val="1"/>
<Column name="artistname" type="string" notnull="yes"/>
<Column name="description" type="text"/>
<Column name="comment" type="text"/>
+ <Column name="flags" type="string">filter flags: defines who can create events with this artist (ignored once it is attached to an event)</Column>
</Table>
<Table name="event" backup="yes">
<Column name="capacity" type="int32" notnull="yes"/>
<!-- flags -->
<Column name="iscancelled" type="bool" default="0"/>
- <Column name="flags" type="string"/>
+ <Column name="flags" type="string">filter: who can sell tickets for this event</Column>
<Column name="tax" type="int32"/>
<!-- reason the event has been cancelled-->
<Column name="cancelreason" type="string"/>
<Column name="pricecategoryid" type="int32" primarykey="yes" foreignkey="pricecategory:pricecategoryid"/>
<Column name="maxavailable" type="int32" notnull="yes"/>
<Column name="price" type="int32" notnull="yes"/>
- <Column name="flags" type="string"/>
+ <Column name="flags" type="string">filter: who can sell tickets in this category for this event</Column>
</Table>
<Class name="Artist">
<Property name="name" type="string"/>
<Property name="description" type="string"/>
<Property name="comment" type="string"/>
+ <Property name="flags" type="astring"/>
+ <Property name="canuse" type="bool"/>
<Mapping table="artist">
<Map column="artistid" property="id"/>
<Map column="artistname" property="name"/>
<Map column="description"/>
<Map column="comment"/>
+ <Map column="flags"/>
+ <Map property="canuse">
+ <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+ </Map>
</Mapping>
</Class>
<Property name="abbreviation" type="astring"/>
<Property name="formula" type="string"/>
<Property name="flags" type="string"/>
+ <Property name="canuse" type="bool"/>
<Mapping table="pricecategory">
<Map column="pricecategoryid"/>
<Map column="name"/>
<Map column="abbreviation"/>
<Map column="formula"/>
<Map column="flags"/>
+ <Map property="canuse">
+ <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+ </Map>
</Mapping>
</Class>
<Property name="maxavailable" type="int32"/>
<Property name="price" type="int32"/>
<Property name="flags" type="string"/>
+ <Property name="canuse" type="bool"/>
<Property name="amounttickets" type="int">calculated property: contains the amount of tickets currently contained in this price, ignored if sent from client</Property>
<Property name="amountticketsblock" type="int">calculated property: contains the amount of tickets currently contained in this price that are actually usable or reserved, ignored if sent from client</Property>
<Map property="amountticketsblock">
<Call lang="php" method="$data->getAmountTicketsBlockFromDB()"/>
</Map>
+ <Map property="canuse">
+ <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+ </Map>
</Mapping>
</Class>
<Property name="description" type="string"/>
<Property name="comment" type="string"/>
<Property name="tax" type="int"/>
+ <Property name="flags" type="string"/>
+ <Property name="canuse" type="bool"/>
<Mapping table="event">
<Map column="eventid" property="id"/>
<Map property="amountReserved">
<Call lang="php" method="$data->getAmountReservedFromDB()"/>
</Map>
+ <Map property="canuse">
+ <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+ </Map>
</Mapping>
</Class>
<Column name="paytype" type="string:64" primarykey="yes"/>
<Column name="description" type="string"/>
<Column name="dataname" type="string:64" null="yes"/>
+ <Column name="flags" type="string">filter: who can log payments with this method</Column>
<Preset><V col="paytype" val="cash"/><V col="description" val="default paytype: cash"/></Preset>
</Table>
</Column>
<Column name="price" type="int32" notnull="yes"/>
<Column name="barcode" type="string" null="yes">usually the EAN code</Column>
- <Column name="flags" type="string"/>
+ <Column name="flags" type="string">filter: who can sell this product</Column>
<Column name="tax" type="int32"/>
</Table>
<Table name="item" backup="yes" audit="yes">
<Property name="shipid" type="int"/>
<Property name="cost" type="int"/>
<Property name="flags" type="string"/>
+ <Property name="canuse" type="bool"/>
<Property name="description" type="string"/>
<Mapping table="shipping">
<Map column="shipid"/>
<Map column="cost"/>
<Map column="flags"/>
<Map column="description"/>
+ <Map property="canuse">
+ <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+ </Map>
</Mapping>
</Class>
<Column name="content" type="blob"/>
<Column name="hash" type="string:32" notnull="yes"/> <!--md5-->
<Column name="dolog" type="bool" default="0"/>
- <Column name="flags" type="string"/>
+ <Column name="flags" type="string">filter: who can use this template</Column>
</Table>
<Class name="Template">
<Property name="hash" type="astring"/> <!--md5-->
<Property name="dolog" type="bool"/>
<Property name="flags" type="string"/>
+ <Property name="canuse" type="bool"/>
<Mapping table="template">
<Map column="filename"/>
<Map column="description"/>
<Map column="hash"/>
<Map column="dolog"/>
<Map column="flags"/>
+ <Map property="canuse">
+ <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+ </Map>
+ <Map property="canuse">
+ <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+ </Map>
</Mapping>
</Class>
<Property name="filename" type="astring"/>
<Property name="description" type="string"/>
<Property name="hash" type="astring"/> <!--md5-->
+ <Property name="flags" type="astring"/>
<Mapping table="template">
<Map column="filename"/>
<Map column="description"/>
<Map column="hash"/>
+ <Map column="flags"/>
+ <Map property="canuse">
+ <Call lang="php" method="$GLOBALS['session']->checkFlags($data->getflags())"/>
+ </Map>
</Mapping>
</Class>
/**checks the given flags item pattern (string or array of strings) and returns true if they match*/
public function checkFlags($iflg)
{
- //admin shortcut
+ //admin shortcut: allow everything
if($this->hasFlag("_admin"))return true;
- if(in_array("_admin",$this-roles))return true;
- //actual check
+ if(in_array("_admin",$this->roles))return true;
+ //actual check for "mere mortals"
if(is_array($iflg))$fp=$iflg;
else $fp=explode(" ",$iflg);
foreach($fp as $f){
+ //discard dummies
+ $f=trim($f);
+ if($f=="")continue;
+ // flag starting with "+": check that user has it
if($f[0]=="+"){
if(!$this->hasFlag(substr($f,1)))return false;
}else
+ // flag starting with "-": check that user does not have it
if($f[0]=="-"){
if($this->hasFlag(substr($f,1)))return false;
}
+ // flag starting with anything else: errrm. error out
else return false;
}
+ //no matches, must be ok then
return true;
}
};