Git Product home page Git Product logo

flask-permissions's People

Contributors

bepetersn avatar d21d3q avatar lemanyk avatar oampo avatar raddevon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flask-permissions's Issues

No Python 3 supported

I'm getting the following error on Python 3 (while the setup.py file makes no claims about supported Python versions):

  File "/Users/dinu/miniconda3/lib/python3.5/site-packages/flask_permissions/models.py", line 112, in __init__
    if roles and isinstance(roles, basestring):
NameError: name 'basestring' is not defined

Is this still being developed?

return 403 code from decorators

Please change strings 35 and 57 in decorators.py from return "You do not have access" to return "You do not have access", 403

Problem with creating make_user_role_table

I've just cloned your repository and tried do run tests locally and they've failed. I've run build on travis and it also failed.

edit:
I found problem here:
user_role_table = make_user_role_table(self.__tablename__, self._id_column_name)
calling self._id_column_name returns proxy object instead of column name (which is being found correctly).
I changed that line to
user_role_table = make_user_role_table(self.__tablename__, self._id_column_name.fget(self))
and build passes, but I am not sure if that fget() can be here called with self

Possible typo in readme

The user.add_abilities() method works just like role.add_abilities(). Pass in a string name or a series of string names. New roles will be created for you. Existing roles will simply be applied to the user. Don't forget to add and commit to the database!

user.add_abilities() should be user.add_roles()?

sqlalchemy.orm.exc.UnmappedColumnError

I download this package by pip, the version is 0.2.3, error has occurred:
sqlalchemy.orm.exc.UnmappedColumnError: Can't execute sync rule for source column 'fp_user.id'; mapper 'Mapper|UserMixin|fp_user' does not map this column. Try using an explicit foreign_keys collection which does not include destination column 'fp_user_role.user_id' (or use a viewonly=True relation).

how to solve this problem~
if I clone package from github,choose the newest version,error has occurred:
AttributeError: 'str' object has no attribute 'fget'

Outdated pip version

Hi,

I know the project is not really active but it remains a useful flask extension.
I struggled using the UserMixin class because Flask-Permissions on pip is outdated.
$ pip install Flask-Permissions
Pip installs a version dating from 2014-04-21.

However, the doc and the the last commit date from 2016-08-14, changing the behaviour of the UserMixin class. I could get around the problem by using:
$ pip install git+https://github.com/raddevon/flask-permissions.git

However it could help other users if you add a new version on Pypi.

Best,

Roch

query problem

Hi
I use UserMixin to create my User class:

class User(UserMixin):
    email = db.Column(db.String(255), unique=True, nullable=False)
    password = db.Column(db.String(255), nullable=False)
    registered_on = db.Column(db.DateTime, nullable=False)
    admin = db.Column(db.Boolean, nullable=False, default=False)

I can save data to the database but I can't fetch anything from database! I think the problem is on type part, when I check the query statement I can see this:

print(User.query)
SELECT fp_user.id AS fp_user_id, fp_user.type AS fp_user_type, fp_user.email AS fp_user_email, fp_user.password AS fp_user_password, fp_user.registered_on AS fp_user_registered_on, fp_user.admin AS fp_user_admin 
FROM fp_user 
WHERE fp_user.type IN (NULL)

and because of this where part nothing coming out from this query!

AttributeError: 'str' object has no attribute 'roles'

Hi, i'm trying to follow the steps but i'm getting a error when i try to add roles to user (UserMIxin instance) and i'm not sure how to put all together..

my_user = UserMixin()
my_user.add_roles('admin', 'superadmin')
db.session.add(my_user)
db.session.commit()

But when i create a normal user, i usually do

my_user = User(name="xxx", email="[email protected]", pass="1234")
db.session.add(my_user)
db.session.commit()

my model is like this:

class User(UserMixin):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), nullable=False)
    email = db.Column(db.String(50), nullable=False, unique=True)
    password = db.Column(db.String(50), nullable=False)

def __init__(self, name, email, password, roles=None):
    """Setting params to the object."""
    self.name = name
    self.email = email.lower()
    self.password = bcrypt.hashpw(
        password.encode('utf-8'), bcrypt.gensalt())
    UserMixin.__init__(self, roles)

.... other methods ...

any tips on how to do i right? :)
(im using @bepetersn fork)

hi how to delete user?

the sql is like this

  1. delete from fp_user_role where id = 3;
  2. delete from user where id = 3;
    but fp_user_role donot define model, so how to delete user ? thank u

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.