Changeset 1397


Ignore:
Timestamp:
Jan 1, 2014, 6:04:12 PM (4 years ago)
Author:
dkg
Message:

update proposals so that anyone can submit them and can edit their own proposals

Location:
trunk/jpdd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/jpdd/class.jpdd.proposal.php

    r1396 r1397  
    2727
    2828        function getCreatePrivilege() {
    29           return array('Update Proposals');
     29          return NULL;
    3030        }
    3131        function getEditPrivilege() {
     
    118118          global $jpdd;
    119119          $this->applyPostForm();
    120           $res = $jpdd->executeSQL('INSERT INTO '.$this->getSingletonTable().' (title, short_title, description, private_notes, min_attendees, max_attendees, event_id) VALUES ('.
     120          $res = $jpdd->executeSQL('INSERT INTO '.$this->getSingletonTable().' (title, short_title, description, private_notes, min_attendees, max_attendees, event_id, proposer_id) VALUES ('.
    121121                                                           $jpdd->stringOrDefault($this->_title).', '.
    122122                                                           $jpdd->stringOrDefault($this->_short_title).', '.
     
    125125                                                           $jpdd->intOrDefault($this->_min_attendees).', '.
    126126                                                           $jpdd->intOrDefault($this->_max_attendees).', '.
    127                                $jpdd->getActiveEventID().')', false);
     127                               $jpdd->getActiveEventID().', '.
     128                               $jpdd->getAuthenticatedUserID().')', false);
    128129          if (false === $res) {
    129130        $logid = $jpdd->log('create proposal failed with pg error: '.pg_last_error($jpdd->_db));
     
    180181          return $ret;
    181182        }
     183
     184    function canBeEditedBy($person) {
     185      return ($person->getID() == $this->_proposer_id);
     186    }
     187
    182188  }
    183189}
  • trunk/jpdd/sql/basics.sql

    r613 r1397  
    7272--
    7373
    74 SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('privilege', 'id'), 13, true);
     74SELECT pg_catalog.setval(pg_catalog.pg_get_serial_sequence('privilege', 'id'), 14, true);
    7575
    7676
     
    939312      Assign Roles    This allows users to assign other people to any role
    949413      Manage Signups  This allows users to manage signups across the entire conference
     9514      Update Proposals        This allows users to modify any proposal in the system
    9596\.
    9697
  • trunk/jpdd/sql/db.sql

    r1396 r1397  
    10611061    category_id integer NOT NULL REFERENCES category(id)
    10621062);
     1063GRANT INSERT,DELETE,SELECT ON proposal_category TO "www-data";
     1064GRANT SELECT,INSERT,UPDATE ON proposal TO "www-data";
     1065GRANT SELECT,UPDATE ON proposal_id_seq TO "www-data";
     1066
     1067ALTER TABLE proposal ADD COLUMN proposer_id integer not null REFERENCES person(id);
Note: See TracChangeset for help on using the changeset viewer.