Пример #1
0
 public function validate() {
     if (!isset($this->id) || $this->id == '') {
         $this->errors[] = "Account is not defined!";
         return false;
     }
     if (!isset($this->realmid) || $this->realmid == '') {
         $this->errors[] = "Realm is not defined!";
         return false;
     }
     if (!isset($this->gmlevel) || $this->gmlevel == '') {
         $this->errors[] = "GM-Level is not defined!";
         return false;
     }
     if($this->new){
         $doup_check = AccountAccess::find()->where(array('id' => $this->id, 'realmid' => $this->realmid))->first();
         if(!empty($doup_check)){
             $this->errors[] = "Can't give multible AccessLevels to the same User on the same Realm";
             return false;
         }
     }
     
     return true;
 }
Пример #2
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/../inc/application_top.php';
if (!isset($_GET['oauth_token'])) {
    throw new SimplException('A Technical Error has Occurred. Please try again.', 2, 'Error: Tried to use callback without GET token.', '/');
}
$myUser = new User();
$myAccountInfo = new AccountInfo();
$myAccountAccess = new AccountAccess();
// Make the temp conenction
$connection = new FormspringOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['temporary_credentials']['oauth_token'], $_SESSION['temporary_credentials']['oauth_token_secret']);
// Get the long lasting token credentials
$token_credentials = $connection->getAccessToken($_GET['oauth_verifier']);
// Grab the details of this user
$details = $connection->get("profile/details");
// Save it to the database
$myUser->ResetValues();
// Check to see if this user is already in the DB
$myUser->SetValue('username', $details->response->username);
$myUser->GetInfo(NULL, array('username'));
// Add the new token credentials
$myUser->SetValue('oauth_token', $token_credentials['oauth_token']);
$myUser->SetValue('oauth_token_secret', $token_credentials['oauth_token_secret']);
// Create a unique ID for the session
$myUser->SetValue('sessionid', uniqid());
// Update the user information if found or insert if new
if (!$myUser->Save()) {
    throw new SimplException('Error Saving Formspring Client Token', 2, 'Error: Error Saving Formspring Client Token :' . $details->response->username);
}
// Set the session cookie
if (!isset($_GET['delegate'])) {
Пример #3
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/../inc/application_top.php';
$myAccess = new AccountAccess();
$delegates = $myAccess->GetDelegates($myUser->GetPrimary());
$smarty->assign('delegates', $delegates);
include_once DIR_ABS . '../inc/application_bottom.php';
// Display the Index Page
$smarty->display('accounts.tpl');
Пример #4
0
 function get_highest_gm_level() {
     $access_level = AccountAccess::find()
             ->where(array('id' => $this->id))
             ->order('gmlevel DESC')
             ->first();
     if(!is_object($access_level))
         return 0;
     else
         return $access_level->gmlevel;
 }
Пример #5
0
 function get_acl(){
     return AccountAccess::find()->where(array('realmid' => $this->id))->order('gmlevel DESC')->all();
 }
 function delete($params){
     $account_access = AccountAccess::find()->where($params)->first();
     if (!empty($account_access)) {
         if (User::$current->account->highest_gm_level > $account_access->account->highest_gm_level) {
             if($account_access->destroy()){
                 $this->flash('success', 'Deleted');
             } else {
                 $this->flash('error', 'Can\'t delete!');
             }
         } else {
             $this->flash('error', 'Your GM-Level have to be highter then the target account\'s level');
         }
     } else {
         $this->flash('error', 'AccountAccess not found!');
     }
     $this->redirect_back();
 }