diff test/test_admin.py @ 8119:c12377fb4144 permission-performance

Change permission representation Now permissions are checked in different order. Permissions without a check method (which are cheap to check) are checked first. Only if no permission is found do we check permissions with check methods.
author Ralf Schlatterbeck <rsc@runtux.com>
date Fri, 18 Oct 2024 16:52:42 +0200
parents 23b7669b2f48
children b4ad03927711
line wrap: on
line diff
--- a/test/test_admin.py	Thu Oct 17 19:13:26 2024 -0400
+++ b/test/test_admin.py	Fri Oct 18 16:52:42 2024 +0200
@@ -1420,33 +1420,33 @@
             ret = self.admin.main()
 
             result = """Role "user":
- User may access the web interface (Web Access)
  User may use the email interface (Email Access)
  User may access the rest interface (Rest Access)
+ User may access the web interface (Web Access)
  User may access the xmlrpc interface (Xmlrpc Access)
- User is allowed to access issue (View for "issue" only)
- User is allowed to edit issue (Edit for "issue" only)
+ User is allowed to create file (Create for "file" only)
+ User is allowed to edit file (Edit for "file" only)
+ User is allowed to access file (View for "file" only)
  User is allowed to create issue (Create for "issue" only)
- User is allowed to access file (View for "file" only)
- User is allowed to edit file (Edit for "file" only)
- User is allowed to create file (Create for "file" only)
+ User is allowed to edit issue (Edit for "issue" only)
+ User is allowed to access issue (View for "issue" only)
+ User is allowed to create keyword (Create for "keyword" only)
+ User is allowed to edit keyword (Edit for "keyword" only)
+ User is allowed to access keyword (View for "keyword" only)
+ User is allowed to create msg (Create for "msg" only)
+ User is allowed to edit msg (Edit for "msg" only)
  User is allowed to access msg (View for "msg" only)
- User is allowed to edit msg (Edit for "msg" only)
- User is allowed to create msg (Create for "msg" only)
- User is allowed to access keyword (View for "keyword" only)
- User is allowed to edit keyword (Edit for "keyword" only)
- User is allowed to create keyword (Create for "keyword" only)
  User is allowed to access priority (View for "priority" only)
+ User is allowed to create queries (Create for "query" only)
+ User is allowed to edit their queries (Edit for "query" only)
+ User is allowed to restore their queries (Restore for "query" only)
+ User is allowed to retire their queries (Retire for "query" only)
+  (Search for "query" only)
+ User is allowed to view their own and public queries (View for "query" only)
  User is allowed to access status (View for "status" only)
+ User is allowed to edit their own user details (Edit for "user": ('username', 'password', 'address', 'realname', 'phone', 'organisation', 'alternate_addresses', 'queries', 'timezone') only)
   (View for "user": ('id', 'organisation', 'phone', 'realname', 'timezone', 'username') only)
  User is allowed to view their own user details (View for "user" only)
- User is allowed to edit their own user details (Edit for "user": ('username', 'password', 'address', 'realname', 'phone', 'organisation', 'alternate_addresses', 'queries', 'timezone') only)
- User is allowed to view their own and public queries (View for "query" only)
-  (Search for "query" only)
- User is allowed to edit their queries (Edit for "query" only)
- User is allowed to retire their queries (Retire for "query" only)
- User is allowed to restore their queries (Restore for "query" only)
- User is allowed to create queries (Create for "query" only)
 """
         print(out.getvalue())
 
@@ -1496,52 +1496,52 @@
 Role "admin":
  User may create everything (Create)
  User may edit everything (Edit)
+ User may use the email interface (Email Access)
+ User may access the rest interface (Rest Access)
  User may restore everything (Restore)
  User may retire everything (Retire)
  User may view everything (View)
  User may access the web interface (Web Access)
- User may access the rest interface (Rest Access)
+ User may manipulate user Roles through the web (Web Roles)
  User may access the xmlrpc interface (Xmlrpc Access)
- User may manipulate user Roles through the web (Web Roles)
- User may use the email interface (Email Access)
 Role "anonymous":
  User may access the web interface (Web Access)
- User is allowed to register new user (Register for "user" only)
+ User is allowed to access file (View for "file" only)
  User is allowed to access issue (View for "issue" only)
- User is allowed to access file (View for "file" only)
+ User is allowed to access keyword (View for "keyword" only)
  User is allowed to access msg (View for "msg" only)
- User is allowed to access keyword (View for "keyword" only)
  User is allowed to access priority (View for "priority" only)
  User is allowed to access status (View for "status" only)
+ User is allowed to register new user (Register for "user" only)
   (Search for "user" only)
 Role "user":
- User may access the web interface (Web Access)
  User may use the email interface (Email Access)
  User may access the rest interface (Rest Access)
+ User may access the web interface (Web Access)
  User may access the xmlrpc interface (Xmlrpc Access)
- User is allowed to access issue (View for "issue" only)
- User is allowed to edit issue (Edit for "issue" only)
+ User is allowed to create file (Create for "file" only)
+ User is allowed to edit file (Edit for "file" only)
+ User is allowed to access file (View for "file" only)
  User is allowed to create issue (Create for "issue" only)
- User is allowed to access file (View for "file" only)
- User is allowed to edit file (Edit for "file" only)
- User is allowed to create file (Create for "file" only)
+ User is allowed to edit issue (Edit for "issue" only)
+ User is allowed to access issue (View for "issue" only)
+ User is allowed to create keyword (Create for "keyword" only)
+ User is allowed to edit keyword (Edit for "keyword" only)
+ User is allowed to access keyword (View for "keyword" only)
+ User is allowed to create msg (Create for "msg" only)
+ User is allowed to edit msg (Edit for "msg" only)
  User is allowed to access msg (View for "msg" only)
- User is allowed to edit msg (Edit for "msg" only)
- User is allowed to create msg (Create for "msg" only)
- User is allowed to access keyword (View for "keyword" only)
- User is allowed to edit keyword (Edit for "keyword" only)
- User is allowed to create keyword (Create for "keyword" only)
  User is allowed to access priority (View for "priority" only)
+ User is allowed to create queries (Create for "query" only)
+ User is allowed to edit their queries (Edit for "query" only)
+ User is allowed to restore their queries (Restore for "query" only)
+ User is allowed to retire their queries (Retire for "query" only)
+  (Search for "query" only)
+ User is allowed to view their own and public queries (View for "query" only)
  User is allowed to access status (View for "status" only)
+ User is allowed to edit their own user details (Edit for "user": ('username', 'password', 'address', 'realname', 'phone', 'organisation', 'alternate_addresses', 'queries', 'timezone') only)
   (View for "user": ('id', 'organisation', 'phone', 'realname', 'timezone', 'username') only)
  User is allowed to view their own user details (View for "user" only)
- User is allowed to edit their own user details (Edit for "user": ('username', 'password', 'address', 'realname', 'phone', 'organisation', 'alternate_addresses', 'queries', 'timezone') only)
- User is allowed to view their own and public queries (View for "query" only)
-  (Search for "query" only)
- User is allowed to edit their queries (Edit for "query" only)
- User is allowed to retire their queries (Retire for "query" only)
- User is allowed to restore their queries (Restore for "query" only)
- User is allowed to create queries (Create for "query" only)
 """
         print(out.getvalue())
 
@@ -1579,43 +1579,50 @@
 Role "admin":
  User may create everything (Create)
  User may edit everything (Edit)
+ User may use the email interface (Email Access)
+ User may access the rest interface (Rest Access)
  User may restore everything (Restore)
  User may retire everything (Retire)
  User may view everything (View)
  User may access the web interface (Web Access)
- User may access the rest interface (Rest Access)
+ User may manipulate user Roles through the web (Web Roles)
  User may access the xmlrpc interface (Xmlrpc Access)
- User may manipulate user Roles through the web (Web Roles)
- User may use the email interface (Email Access)
 Role "anonymous":
  User may access the web interface (Web Access)
- User is allowed to register new user (Register for "user" only)
+ User is allowed to access file (View for "file" only)
  User is allowed to access issue (View for "issue" only)
- User is allowed to access file (View for "file" only)
+ User is allowed to access keyword (View for "keyword" only)
  User is allowed to access msg (View for "msg" only)
- User is allowed to access keyword (View for "keyword" only)
  User is allowed to access priority (View for "priority" only)
  User is allowed to access status (View for "status" only)
+ User is allowed to register new user (Register for "user" only)
   (Search for "user" only)
 Role "user":
- User may access the web interface (Web Access)
  User may use the email interface (Email Access)
  User may access the rest interface (Rest Access)
+ User may access the web interface (Web Access)
  User may access the xmlrpc interface (Xmlrpc Access)
- User is allowed to access issue (View for "issue" only)
- User is allowed to edit issue (Edit for "issue" only)
+ User is allowed to create file (Create for "file" only)
+ User is allowed to edit file (Edit for "file" only)
+ User is allowed to access file (View for "file" only)
  User is allowed to create issue (Create for "issue" only)
- User is allowed to access file (View for "file" only)
- User is allowed to edit file (Edit for "file" only)
- User is allowed to create file (Create for "file" only)
+ User is allowed to edit issue (Edit for "issue" only)
+ User is allowed to access issue (View for "issue" only)
+ User is allowed to create keyword (Create for "keyword" only)
+ User is allowed to edit keyword (Edit for "keyword" only)
+ User is allowed to access keyword (View for "keyword" only)
+ User is allowed to create msg (Create for "msg" only)
+ User is allowed to edit msg (Edit for "msg" only)
  User is allowed to access msg (View for "msg" only)
- User is allowed to edit msg (Edit for "msg" only)
- User is allowed to create msg (Create for "msg" only)
- User is allowed to access keyword (View for "keyword" only)
- User is allowed to edit keyword (Edit for "keyword" only)
- User is allowed to create keyword (Create for "keyword" only)
  User is allowed to access priority (View for "priority" only)
+ User is allowed to create queries (Create for "query" only)
+ User is allowed to edit their queries (Edit for "query" only)
+ User is allowed to restore their queries (Restore for "query" only)
+ User is allowed to retire their queries (Retire for "query" only)
+  (Search for "query" only)
+ User is allowed to view their own and public queries (View for "query" only)
  User is allowed to access status (View for "status" only)
+ User is allowed to edit their own user details (Edit for "user": ('username', 'password', 'address', 'realname', 'phone', 'organisation', 'alternate_addresses', 'queries', 'timezone') only)
   (View for "user": ('id', 'organization', 'phone', 'realname', 'timezone', 'username') only)
 
   **Invalid properties for user: ['organization']

Roundup Issue Tracker: http://roundup-tracker.org/