title: how can I make specific routes accessible only for specific users in flask?
body: <p>I'm using flask and mongodb, I have a user table where it has a boolean attribute <strong>is_admin</strong> and I want to make specefic views and routes accessible only for admin users, I have read about Flask-admin and Flask-Principal but they seemed complicated to me since I am very beginner and its just a school project, is there a way to achieve that without using Flask-Principle?.
  for example I want only admin to access this route</p>
  <pre><code>@users.route('/add', methods=['GET', 'POST'])
  @login_required
  def add():
      form = UserForm(request.form)
      if request.method == 'POST':
          if form.validate():
              user = User(username=form.username.data, password= generate_password_hash(form.password.data), vorname=form.vorname.data, nachname=form.nachname.data, geburtsdatum=form.geburtsdatum.data, email=form.email.data, admin=form.admin.data, aktiv=form.aktiv.data)
              user.save()
              flash(&quot;user added successfully.&quot;, &quot;success&quot;)
              return redirect(url_for('.index'))
      return render_template('form.html', users=users, form=form, info=session)
  </code></pre>