mirror of
https://github.com/wassname/flask-security.git
synced 2026-06-27 16:10:11 +08:00
Random fixes
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
.DS_Store
|
||||
*.pyc
|
||||
*.egg
|
||||
*egg-info
|
||||
dist
|
||||
.project
|
||||
.pydevproject
|
||||
.settings
|
||||
|
||||
@@ -2,8 +2,19 @@ MIT License
|
||||
|
||||
Copyright (C) 2012 by Matt Wright
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
+19
-3
@@ -28,6 +28,7 @@ Contents
|
||||
* :ref:`overview`
|
||||
* :ref:`installation`
|
||||
* :ref:`getting-started`
|
||||
* :ref:`flask-script-commands`
|
||||
* :ref:`api`
|
||||
* :doc:`Changelog </changelog>`
|
||||
|
||||
@@ -58,7 +59,7 @@ Installation
|
||||
First, install Flask-Security::
|
||||
|
||||
$ mkvirtualenv app-name
|
||||
$ pip install https://github.com/mattupstate/flask-security/tarball/master
|
||||
$ pip install Flask-Security
|
||||
|
||||
Then install your datastore requirement.
|
||||
|
||||
@@ -81,8 +82,8 @@ First thing you'll want to do is setup your application and datastore::
|
||||
|
||||
from flask import Flask, render_template
|
||||
from flask.ext.sqlalchemy import SQLAlchemy
|
||||
from flask.ext.security import User, Security, LoginForm,
|
||||
login_required, roles_accepted, user_datastore
|
||||
from flask.ext.security import (User, Security, LoginForm, login_required,
|
||||
roles_accepted, user_datastore)
|
||||
from flask.ext.security.datastore.sqlalchemy import SQLAlchemyUserDataStore
|
||||
|
||||
app = Flask(__name__)
|
||||
@@ -150,6 +151,21 @@ specific role::
|
||||
{% if current_user.has_role('admin') %}
|
||||
<a href="{{ url_for('admin.index') }}">Admin Panel</a>
|
||||
{$ endif %}
|
||||
|
||||
|
||||
.. _flask-script-commands:
|
||||
|
||||
Flask-Script Commands
|
||||
---------------------
|
||||
Flask-Security comes packed with a few Flask-Script commands. They are:
|
||||
|
||||
* :class:`flask.ext.security.script.CreateUserCommand`
|
||||
* :class:`flask.ext.security.script.AddRoleCommand`
|
||||
* :class:`flask.ext.security.script.RemoveRoleCommand`
|
||||
* :class:`flask.ext.security.script.DeactivateUserCommand`
|
||||
* :class:`flask.ext.security.script.ActivateUserCommand`
|
||||
|
||||
Register these on your script manager for pure convenience.
|
||||
|
||||
|
||||
.. _configuration:
|
||||
|
||||
Reference in New Issue
Block a user