Example #1
0
def delete(role_id):
    people = db.person_get(role_id=role_id)
    role = get(role_id=role_id)
    if people:
        abort(400, u'There are {} {}(s) registered. Remove those People first.'.format(len(people), role.name))
    db.role_delete(role_id)
    notify(u'{} deleted a Role - <strong>%s</strong>' % role.name, action='delete', target='person')
Example #2
0
def delete(person_id, user_id, company_id):
    if person_id == user_id:
        abort(400, "You can't delete your own account. Coming soon!")
    if company.get(company_id).owner.id == person_id:
        abort(400, "You can't delete the company's owner")
    user_name = db.person_get(user_id=person_id).name
    db.person_delete(person_id)
    notify(u'{} deleted a Person - <strong>%s</strong>' % user_name, action='delete', target='person')
Example #3
0
def add(new_person, user_id):
    if new_person['invite'] and not new_person.get('email'):
        abort(400, 'Please specify an email address to send the invitation to, or uncheck the invitation box.')

    db.person_add(new_person)

    if new_person['invite']:
        invite(new_person['email'], user_id)

    notify(u'{} added a new Person - <strong>%s</strong>' % new_person['name'], action='add', target='person')
Example #4
0
def add(role, company_id):
    db.role_add(role, company_id)
    notify(u'{} added a new Role - <strong>%s</strong>' % role['name'], action='add', target='person')
Example #5
0
def update(role):
    db.role_update(role)
    db.person_role_update(role)
    notify(u'{} edited a Role - <strong>%s</strong>' % role['name'], action='edit', target='person')
Example #6
0
def update(updated_place):
    db.place_update(updated_place)
    notify(u'{} updated a Place - <strong>%s</strong>' % updated_place['name'], action='edit', target='place')
Example #7
0
def add(new_place):
    db.place_add(new_place)
    notify(u'{} added a new Place - <strong>%s</strong>' % new_place['name'], action='add', target='place')
Example #8
0
def delete(place_id):
    place_name = db.place_get(place_id=place_id).name
    if db.event_get(place_id=place_id):
        abort(400, 'There are Events associated with this Place')
    db.place_delete(place_id)
    notify(u'{} deleted a Place - <strong>%s</strong>' % place_name, action='delete', target='place')
Example #9
0
def update(person):
    name = db.person_update(person)
    notify(u'{} updated details for <strong>%s</strong>' % name, action='edit', target='person')