コード例 #1
0
ファイル: ModuleObject.php プロジェクト: uzerpllp/uzerp
 function disable()
 {
     $permission = new Permission();
     $cc = new ConstraintChain();
     $cc->add(new Constraint('permission', '=', $this->name));
     $permission->loadBy($cc);
     if ($permission && $permission->delete()) {
         return $this->update($this->id, 'enabled', false);
     }
     return true;
 }
コード例 #2
0
 public function procede()
 {
     try {
         if ($this->oRequest->existParam('m')) {
             if (!$this->oRequest->existParam('r')) {
                 throw new Error('FRAMEWORK_ERROR_ACCESS_UNKNOWN', 3);
             }
             $oPermission = new Permission($this->oRequest->getParam('m', 'int'), $this->oRequest->getParam('r', 'int'));
             if ($this->oRequest->getParam('v', 'boolean')) {
                 $oPermission->store();
             } else {
                 $oPermission->delete();
             }
             Logger::log('admin', Language::translate('PERMISSIONS_ADMIN_ACCESS_UPDATELOG') . '[' . $this->oCurrentUser->getLogin() . ']');
             $this->oView->addAlert(Language::translate('PERMISSIONS_ADMIN_ACCESS_UPDATE'), 'success');
         }
     } catch (Exception $ex) {
         $this->oView->addAlert($ex, 'danger');
     } finally {
         $this->createView();
     }
 }
コード例 #3
0
ファイル: Auth_simpleauth.php プロジェクト: Moro3/duc
 /**
  * Remove Permission
  * Remove a permission from the database
  * 
  * @param mixed $permission
  */
 public function remove_permission($permission)
 {
     $p = new Permission();
     $p->get_by_permission($permission);
     if (!$p->exists()) {
         $p->delete();
     }
 }
コード例 #4
0
 public function delete()
 {
     // we're echoing JSON, so lets tell the browser
     // this is required for $.ajax to be able to intelligently guess what the dataType is
     header('Content-type: application/json');
     // get the id from data
     if (is_ajax()) {
         $id = !empty($this->_data['id']) ? $this->_data['id'] : $_id;
     }
     $permission = new Permission();
     // NOTE: the db will take care od cascading the delete to child rows
     if ($permission->delete($id)) {
         echo json_encode(array('success' => TRUE));
     } else {
         echo json_encode(array('success' => FALSE));
     }
     exit;
 }
コード例 #5
0
<?php

session_start();
include_once "../php/Permission.php";
if (isset($_POST['save'])) {
    $permission = new Permission();
    $permission->lockSerial($_POST['lock']);
    $permission->recipientIdentification($_POST['recipient']);
    $permission->startDateHour($_POST['startDateHour']);
    $permission->endDateHour($_POST['endDateHour']);
    echo "tt";
    $permission->insert();
} elseif (isset($_POST['update'])) {
    $permission = new Permission();
    $permission->lockSerial($_POST['lock']);
    $permission->recipientIdentification($_POST['recipient']);
    $permission->startDateHour($_POST['startDateHour']);
    $permission->endDateHour($_POST['endDateHour']);
    $permission->update();
} elseif (isset($_POST['delete'])) {
    Permission::delete($_POST['lock'], $_POST['recipient']);
}
header("location: showPermissions.php");
コード例 #6
0
 public function managePermission($action)
 {
     try {
         $user_name = fRequest::get('user_name');
         $permission_name = fRequest::get('permission_name');
         if ($action == 'Add') {
             if (User::can('add-permission')) {
                 $permission = new Permission();
                 $permission->setUserName($user_name);
                 $permission->setPermissionName($permission_name);
                 $permission->store();
                 fMessaging::create('success', 'Permission added successfully.');
             } else {
                 throw new fAuthorizationException('You are not allowed to add permissions.');
             }
         } else {
             if ($action == 'Remove') {
                 if (User::can('remove-permission')) {
                     $permission = new Permission(array('user_name' => $user_name, 'permission_name' => $permission_name));
                     $permission->delete();
                     fMessaging::create('success', 'Permission removed successfully.');
                 } else {
                     throw new fAuthorizationException('You are not allowed to remove permissions.');
                 }
             }
         }
     } catch (fException $e) {
         fMessaging::create('error', $e->getMessage());
     }
     fURL::redirect(Util::getReferer());
 }