ここの情報は古いです。ご理解頂いた上でお取り扱いください。

source: OpenPNE3/trunk/lib/behavior/opCheckPrivilageBelongBehavior.class.php @ 9448

Last change on this file since 9448 was 9448, checked in by masabon, 13 years ago

#3028:add opCheckPrivilageBelongBehavior

File size: 620 bytes
RevLine 
[9448]1<?php
2class opCheckPrivilageBelongBehavior
3{
4  public function checkPrivilageBelong($object, $member_id)
5  {
6    $this_class = get_class($object);
7    $class_name = sfConfig::get('propel_behavior_check_privilage_belong_'.$this_class.'_class_name');
8
9    $class = new $class_name();
10    $peer = $class->getPeer();
11    $column_name = get_class($peer).'::MEMBER_ID';
12
13    $c = new Criteria();
14    $c->add(constant($column_name),  $member_id, Criteria::EQUAL);
15
16    $result = $peer->doSelectStmt($c);
17    $row = $result->fetch(PDO::FETCH_NUM);
18
19    if (!$row)
20    {
21      throw new opPrivilegeException('fail');
22    }
23  }
24}
Note: See TracBrowser for help on using the repository browser.