Questions tagged [flask-principal]
23 questions
1
vote
1 answer
need more than one require in flask principal
I am using flask principal, the latest version Flask-Principal (0.4.0)
I have certain url route e.g. gpsData, reports, entry etc
individual route can be viewed by multiple user role
url------------Role
gpsData -- admin, reporter, client
reports --…

beebek
- 1,893
- 5
- 29
- 33
0
votes
1 answer
Trying to use flask principal to restrict access to particular web pages
Hello am new at using flask and I have been trying to figure out how to restrict some web pages unless logged in. I tried flask decorators I tried flask decorators but I couldn't understand it so I tried using flask principal which am able to get it…

peter karanja
- 39
- 1
- 1
- 5
0
votes
1 answer
How do I restrict an user's access with Flask_Principal and Flask-Security?
I'm creating a project and I would like to restrict an user's access with Flask_Principal?
I'm studying that, soo... I know fell things about those microframeworks.
Basically... The user will access the Home Page, and if he doesn't have a login, he…

Rodrigo Pasini
- 13
- 1
- 1
- 5
0
votes
2 answers
Have a custom primary key for users.id in flask-security
I want to have a custom key for the field id, for example, id_user, I've tried the following
class UserModel(db.model, UserMixin)
...
@property
def id(self):
return self.id_user
But couldn't make it work. When I try to…

Hugo Pablo
- 81
- 1
- 9
0
votes
1 answer
How can I hide certain links in jinja2 template engine using Flask-Login and Permission class from Flask-Principal?
I am following the documentation and have already created my Permission instances so I can decorate my route functions, however, I have no idea how to hide links in the template. I saw an answer on here that used Roles but is there a way to use…

8oh8
- 1,247
- 5
- 19
- 35
0
votes
1 answer
Add attributes to Python module at runtime to be imported later
I'm adding attributes to a module at runtime using the following inside a loop:
this_module = sys.modules[__name__]
setattr(this_module, attr_name, attr_value)
When I call print dir(this_module) from the module, it shows the attributes. Great!
When…

Logan Bibby
- 1,167
- 1
- 10
- 31
0
votes
1 answer
Conditional logic based on Flask Principal
Is there a way to access the flask principal in order to execute some code conditionally?
In a functiod, I'd like to do something like:
def load_some_stuff():
if :
load_report_data()
#more code, render template…

fansonly
- 1,150
- 4
- 14
- 29
0
votes
1 answer
decorator require doens't work correctly in flask-principal in my sample
I have problem with decorator require(http_exception=401) in flask-principal. I am trying to access to site which requires login, but I am able to access there. Do you have any idea why? My code following:
infrastructure.py
app = Flask(__name__)
db…

user1743947
- 163
- 1
- 2
- 12