GithubHelp home page GithubHelp logo

ubclaunchpad / bounce Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 4.0 3.54 MB

๐Ÿ€ Bringing people with common interests together

License: MIT License

Makefile 1.70% Python 97.56% Dockerfile 0.74%

bounce's People

Contributors

amirnaghibi avatar bfbachmann avatar bobheadxi avatar davidw7 avatar ginsstaahh avatar joshmarangoni avatar ktabouguia avatar stanleyye avatar tariqabulaban avatar victorwu95 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bounce's Issues

Set up roles for memberhips

Members should have roles that we can use to determine their permissions within the app.

Roles

Owner

  • read club
  • update club
  • delete club
  • create memberships with any role
  • read all memberships
  • delete memberships of all members except other owners

Admin

  • read club
  • update club
  • read all memberships
  • create memberships with member role
  • delete memberships with member role

Member

  • read club
  • read all memberships
  • delete their own membership

Memberships

DB Table

user_id club_id role position

Example JSON

{
    "user_id": 1,
    "club_id": 1,
    "position": "VP Marketing",
    "role": "admin"
}

Add dynamic links to the navbar

See Angel's design here: https://www.figma.com/file/J5H98x6IAk5YVNdfOrpsZ68q/Clubs-app-sketch-file?node-id=0%3A1
We should have

When the user is signed in:

  • MyClubs link
  • Explore link
  • A dropdown link to the user's profile and settings (just use the default small-logo.png as the user's profile pic) if the user is signed in. This dropdown should contain
    • Settings links to the edit account page
    • My Clubs link when the user is signed in (note that we don't really have a MyClubsPage, so this link can be dead for now)
    • Sign Out link

When the user is not signed in:

  • Sign In link

Use es6 for frontend

  • cleaner / less code needed
  • can use babel transpiler to convert es6 to javascript for older browsers

Create a membership

The new membership associates an existing user with an existing club.

  1. Create an insert method in bounce/db/membership.py for inserting new users into the DB (see bounce/db/user.py as an example)
  2. Create a Membership resource in bounce/server/resource/membership.py that specifies all the information required for creating a new membership.
  3. Create a post method for a Memberships endpoint in bounce/server/api/memberships.py (see users.py as an example).

Fix CORS headers on error responses from the backend

We're only setting the Access-Control-Allow-Origin header on our successful responses, but we should be setting it on all responses, otherwise the client in the browser will raise an error when receiving non-200-level responses.

Fix access to /clubs endpoint

Currently anyone with access to the API can CRUD clubs, but only people who own a club should be able to do that. This fix should involve making a user an owner of a club when creating a club and making sure that the owner is authenticated before serving delete or update requests on a club.

Use HTTPS only

For security reasons we should only be serving requests over HTTPS.

Fix react-bootstrap warning

Warning: Failed prop type: Invalid prop `bsStyle` of value `secondary` supplied to `Button`, expected one of ["success","warning","danger","info","default","primary","link"].
    in Button (at Home.js:43)
    in Home (at App.js:91)
    in bound getHomePage (created by Route)
    in Route (at App.js:102)
    in Switch (at App.js:101)
    in Router (created by BrowserRouter)
    in BrowserRouter (at App.js:100)
    in App (at index.js:10)

List paginated clubs on the back-end

This will be a GET request to /clubs/search

  • The search endpoint should allow for optional query and page parameters. page defaults to 1 when it's not specified in the request and it marks the offset in the results that you should return results from. You should expect the client to make mistakes and specify an offset that is too large (for example, there is one search result and they specify an offset of 20), in which case you should return a 400 (bad request)). If query isn't specified, just return the top N most recently created clubs.
  • Decide on a page size N and LIMIT queries to size N results.

Example response format:

{
    'results': [ { ... } , ...], # results
    'result_count': result_count, 
    'page': page, 
    'total_pages': total_pages
}

upgrade the dependencies

also add the --upgrade flag in the makefile when calling make requirements and make test-requirements

error creating json web token

The following occurs when i try to create a new user

[2018-08-11 21:52:43 +0000] [7] [ERROR] An error occurred during the handling of a POST request to LoginEndpoint                                                                                              
Traceback (most recent call last):                                                                     
  File "/usr/local/lib/python3.6/site-packages/jose/jws.py", line 163, in _sign_header_and_claims      
    key = jwk.construct(key_data, algorithm)                                                           
  File "/usr/local/lib/python3.6/site-packages/jose/jwk.py", line 61, in construct                     
    return key_class(key_data, algorithm)                                                              
  File "/usr/local/lib/python3.6/site-packages/jose/jwk.py", line 101, in __init__                     
    raise JWKError('Expecting a string- or bytes-formatted key.')                                      
jose.exceptions.JWKError: Expecting a string- or bytes-formatted key.                                  
                                                                                                       
During handling of the above exception, another exception occurred:                                    
                                                                                                       
Traceback (most recent call last):                                                                     
  File "/opt/bounce/bounce/server/api/__init__.py", line 117, in handle_request                        
    request, *args, **kwargs)                                                                          
  File "/opt/bounce/bounce/server/resource/__init__.py", line 109, in wrapper                          
    result = await coro(endpoint, request, *args, **kwargs)                                            
  File "/opt/bounce/bounce/server/api/auth.py", line 32, in post                                       
    token = util.create_jwt(user_row.identifier, self.server.config.secret)                            
  File "/opt/bounce/bounce/server/api/util.py", line 125, in create_jwt                                
    algorithm='HS256')                                                                                 
  File "/usr/local/lib/python3.6/site-packages/jose/jwt.py", line 61, in encode                        
    return jws.sign(claims, key, headers=headers, algorithm=algorithm)                                 
  File "/usr/local/lib/python3.6/site-packages/jose/jws.py", line 46, in sign                          
    signed_output = _sign_header_and_claims(encoded_header, encoded_payload, algorithm, key)           
  File "/usr/local/lib/python3.6/site-packages/jose/jws.py", line 166, in _sign_header_and_claims      
    raise JWSError(e)                                                                                  
jose.exceptions.JWSError: Expecting a string- or bytes-formatted key.                                  
[2018-08-11 21:52:43 +0000] - (sanic.access)[INFO][1:7]: POST http://localhost:8080/auth/login  500 33 
[2018-08-11 21:52:48 +0000] [7] [INFO] KeepAlive Timeout. Closing connection.                          

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.