public function detailsAction()
 {
     // set up the mappers and
     // get user and store info from database
     $this->getStoreAndUser();
     // check priveleges
     if (!$this->_acl->isAllowed($this->user, $this->store, 'manage')) {
         $this->errorAndRedirect('You do not have priveleges to manage that store');
     }
     // get shipping addresses for store
     $shippingMapper = new Application_Model_Mapper_Stores_ShippingAddressesMapper();
     $this->store->shippingAddresses = $shippingMapper->getShippingAddressesForStoreID($this->store->storeID);
     // get the default shipping address if it exists
     $defaultShipping = null;
     foreach ($this->store->shippingAddresses as $address) {
         if ($address->shippingAddressID == $this->store->defaultShippingAddressID) {
             $defaultShipping = $address;
         }
     }
     $this->store->defaultShippingAddress = $defaultShipping;
     // get list of users for this store
     $linksMapper = new Application_Model_Mapper_Stores_StoresUsersLinksMapper();
     $options = array('include' => array('linkRole', 'username'));
     $this->store->userLinks = $linksMapper->fetchUserLinksForStoreID($this->store->storeID, $options);
     // send store to the view
     $this->view->store = $this->store;
 }
 public function assert(Zend_Acl $acl, Zend_Acl_Role_Interface $user = null, Zend_Acl_Resource_Interface $store = null, $privelege = null)
 {
     // check for a link in the link table
     $linksMapper = new Application_Model_Mapper_Stores_StoresUsersLinksMapper();
     $link = $linksMapper->findLink($store->storeID, $user->userID);
     if (!$link) {
         return false;
     }
     // check for certain priveleges based on linkRole
     if ($privelege == 'update') {
         if ($link->linkRole != 'admin') {
             return false;
         }
     }
     return true;
 }
 public function detailsAction()
 {
     // set up the usersMapper and
     // get the logged in user's info from the database
     $this->getLoggedInUser();
     // get user's shipping addresses
     $shippingMapper = new Application_Model_Mapper_Users_ShippingAddressesMapper();
     $this->user->shippingAddresses = $shippingMapper->getShippingAddressesForUser($this->user);
     // get the default shipping address if it exists
     $defaultShipping = null;
     foreach ($this->user->shippingAddresses as $address) {
         if ($address->shippingAddressID == $this->user->defaultShippingAddressID) {
             $defaultShipping = $address;
         }
     }
     $this->user->defaultShippingAddress = $defaultShipping;
     // get list of stores for this user
     $linksMapper = new Application_Model_Mapper_Stores_StoresUsersLinksMapper();
     $options = array('include' => array('linkRole', 'storeName', 'storeDisplayName'));
     $this->user->storeLinks = $linksMapper->fetchStoreLinksForUserID($this->user->userID, $options);
     // send the user to the view
     $this->view->user = $this->user;
 }