comparison 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
comparison
equal deleted inserted replaced
8118:c88ad93f0e77 8119:c12377fb4144
1418 # lower cased interally 1418 # lower cased interally
1419 sys.argv=['main', '-i', self.dirname, 'security', "user" ] 1419 sys.argv=['main', '-i', self.dirname, 'security', "user" ]
1420 ret = self.admin.main() 1420 ret = self.admin.main()
1421 1421
1422 result = """Role "user": 1422 result = """Role "user":
1423 User may access the web interface (Web Access)
1424 User may use the email interface (Email Access) 1423 User may use the email interface (Email Access)
1425 User may access the rest interface (Rest Access) 1424 User may access the rest interface (Rest Access)
1425 User may access the web interface (Web Access)
1426 User may access the xmlrpc interface (Xmlrpc Access) 1426 User may access the xmlrpc interface (Xmlrpc Access)
1427 User is allowed to create file (Create for "file" only)
1428 User is allowed to edit file (Edit for "file" only)
1429 User is allowed to access file (View for "file" only)
1430 User is allowed to create issue (Create for "issue" only)
1431 User is allowed to edit issue (Edit for "issue" only)
1427 User is allowed to access issue (View for "issue" only) 1432 User is allowed to access issue (View for "issue" only)
1428 User is allowed to edit issue (Edit for "issue" only) 1433 User is allowed to create keyword (Create for "keyword" only)
1429 User is allowed to create issue (Create for "issue" only) 1434 User is allowed to edit keyword (Edit for "keyword" only)
1430 User is allowed to access file (View for "file" only) 1435 User is allowed to access keyword (View for "keyword" only)
1431 User is allowed to edit file (Edit for "file" only) 1436 User is allowed to create msg (Create for "msg" only)
1432 User is allowed to create file (Create for "file" only) 1437 User is allowed to edit msg (Edit for "msg" only)
1433 User is allowed to access msg (View for "msg" only) 1438 User is allowed to access msg (View for "msg" only)
1434 User is allowed to edit msg (Edit for "msg" only)
1435 User is allowed to create msg (Create for "msg" only)
1436 User is allowed to access keyword (View for "keyword" only)
1437 User is allowed to edit keyword (Edit for "keyword" only)
1438 User is allowed to create keyword (Create for "keyword" only)
1439 User is allowed to access priority (View for "priority" only) 1439 User is allowed to access priority (View for "priority" only)
1440 User is allowed to create queries (Create for "query" only)
1441 User is allowed to edit their queries (Edit for "query" only)
1442 User is allowed to restore their queries (Restore for "query" only)
1443 User is allowed to retire their queries (Retire for "query" only)
1444 (Search for "query" only)
1445 User is allowed to view their own and public queries (View for "query" only)
1440 User is allowed to access status (View for "status" only) 1446 User is allowed to access status (View for "status" only)
1447 User is allowed to edit their own user details (Edit for "user": ('username', 'password', 'address', 'realname', 'phone', 'organisation', 'alternate_addresses', 'queries', 'timezone') only)
1441 (View for "user": ('id', 'organisation', 'phone', 'realname', 'timezone', 'username') only) 1448 (View for "user": ('id', 'organisation', 'phone', 'realname', 'timezone', 'username') only)
1442 User is allowed to view their own user details (View for "user" only) 1449 User is allowed to view their own user details (View for "user" only)
1443 User is allowed to edit their own user details (Edit for "user": ('username', 'password', 'address', 'realname', 'phone', 'organisation', 'alternate_addresses', 'queries', 'timezone') only)
1444 User is allowed to view their own and public queries (View for "query" only)
1445 (Search for "query" only)
1446 User is allowed to edit their queries (Edit for "query" only)
1447 User is allowed to retire their queries (Retire for "query" only)
1448 User is allowed to restore their queries (Restore for "query" only)
1449 User is allowed to create queries (Create for "query" only)
1450 """ 1450 """
1451 print(out.getvalue()) 1451 print(out.getvalue())
1452 1452
1453 self.assertEqual(result, out.getvalue()) 1453 self.assertEqual(result, out.getvalue())
1454 self.assertEqual(ret, 0) 1454 self.assertEqual(ret, 0)
1494 result = """New Web users get the Role "User" 1494 result = """New Web users get the Role "User"
1495 New Email users get the Role "User" 1495 New Email users get the Role "User"
1496 Role "admin": 1496 Role "admin":
1497 User may create everything (Create) 1497 User may create everything (Create)
1498 User may edit everything (Edit) 1498 User may edit everything (Edit)
1499 User may use the email interface (Email Access)
1500 User may access the rest interface (Rest Access)
1499 User may restore everything (Restore) 1501 User may restore everything (Restore)
1500 User may retire everything (Retire) 1502 User may retire everything (Retire)
1501 User may view everything (View) 1503 User may view everything (View)
1502 User may access the web interface (Web Access) 1504 User may access the web interface (Web Access)
1503 User may access the rest interface (Rest Access) 1505 User may manipulate user Roles through the web (Web Roles)
1504 User may access the xmlrpc interface (Xmlrpc Access) 1506 User may access the xmlrpc interface (Xmlrpc Access)
1505 User may manipulate user Roles through the web (Web Roles)
1506 User may use the email interface (Email Access)
1507 Role "anonymous": 1507 Role "anonymous":
1508 User may access the web interface (Web Access) 1508 User may access the web interface (Web Access)
1509 User is allowed to register new user (Register for "user" only) 1509 User is allowed to access file (View for "file" only)
1510 User is allowed to access issue (View for "issue" only) 1510 User is allowed to access issue (View for "issue" only)
1511 User is allowed to access file (View for "file" only) 1511 User is allowed to access keyword (View for "keyword" only)
1512 User is allowed to access msg (View for "msg" only) 1512 User is allowed to access msg (View for "msg" only)
1513 User is allowed to access keyword (View for "keyword" only)
1514 User is allowed to access priority (View for "priority" only) 1513 User is allowed to access priority (View for "priority" only)
1515 User is allowed to access status (View for "status" only) 1514 User is allowed to access status (View for "status" only)
1515 User is allowed to register new user (Register for "user" only)
1516 (Search for "user" only) 1516 (Search for "user" only)
1517 Role "user": 1517 Role "user":
1518 User may access the web interface (Web Access)
1519 User may use the email interface (Email Access) 1518 User may use the email interface (Email Access)
1520 User may access the rest interface (Rest Access) 1519 User may access the rest interface (Rest Access)
1520 User may access the web interface (Web Access)
1521 User may access the xmlrpc interface (Xmlrpc Access) 1521 User may access the xmlrpc interface (Xmlrpc Access)
1522 User is allowed to create file (Create for "file" only)
1523 User is allowed to edit file (Edit for "file" only)
1524 User is allowed to access file (View for "file" only)
1525 User is allowed to create issue (Create for "issue" only)
1526 User is allowed to edit issue (Edit for "issue" only)
1522 User is allowed to access issue (View for "issue" only) 1527 User is allowed to access issue (View for "issue" only)
1523 User is allowed to edit issue (Edit for "issue" only) 1528 User is allowed to create keyword (Create for "keyword" only)
1524 User is allowed to create issue (Create for "issue" only) 1529 User is allowed to edit keyword (Edit for "keyword" only)
1525 User is allowed to access file (View for "file" only) 1530 User is allowed to access keyword (View for "keyword" only)
1526 User is allowed to edit file (Edit for "file" only) 1531 User is allowed to create msg (Create for "msg" only)
1527 User is allowed to create file (Create for "file" only) 1532 User is allowed to edit msg (Edit for "msg" only)
1528 User is allowed to access msg (View for "msg" only) 1533 User is allowed to access msg (View for "msg" only)
1529 User is allowed to edit msg (Edit for "msg" only)
1530 User is allowed to create msg (Create for "msg" only)
1531 User is allowed to access keyword (View for "keyword" only)
1532 User is allowed to edit keyword (Edit for "keyword" only)
1533 User is allowed to create keyword (Create for "keyword" only)
1534 User is allowed to access priority (View for "priority" only) 1534 User is allowed to access priority (View for "priority" only)
1535 User is allowed to create queries (Create for "query" only)
1536 User is allowed to edit their queries (Edit for "query" only)
1537 User is allowed to restore their queries (Restore for "query" only)
1538 User is allowed to retire their queries (Retire for "query" only)
1539 (Search for "query" only)
1540 User is allowed to view their own and public queries (View for "query" only)
1535 User is allowed to access status (View for "status" only) 1541 User is allowed to access status (View for "status" only)
1542 User is allowed to edit their own user details (Edit for "user": ('username', 'password', 'address', 'realname', 'phone', 'organisation', 'alternate_addresses', 'queries', 'timezone') only)
1536 (View for "user": ('id', 'organisation', 'phone', 'realname', 'timezone', 'username') only) 1543 (View for "user": ('id', 'organisation', 'phone', 'realname', 'timezone', 'username') only)
1537 User is allowed to view their own user details (View for "user" only) 1544 User is allowed to view their own user details (View for "user" only)
1538 User is allowed to edit their own user details (Edit for "user": ('username', 'password', 'address', 'realname', 'phone', 'organisation', 'alternate_addresses', 'queries', 'timezone') only)
1539 User is allowed to view their own and public queries (View for "query" only)
1540 (Search for "query" only)
1541 User is allowed to edit their queries (Edit for "query" only)
1542 User is allowed to retire their queries (Retire for "query" only)
1543 User is allowed to restore their queries (Restore for "query" only)
1544 User is allowed to create queries (Create for "query" only)
1545 """ 1545 """
1546 print(out.getvalue()) 1546 print(out.getvalue())
1547 1547
1548 self.assertEqual(result, out.getvalue()) 1548 self.assertEqual(result, out.getvalue())
1549 self.assertEqual(ret, 0) 1549 self.assertEqual(ret, 0)
1577 result = """New Web users get the Role "User" 1577 result = """New Web users get the Role "User"
1578 New Email users get the Role "User" 1578 New Email users get the Role "User"
1579 Role "admin": 1579 Role "admin":
1580 User may create everything (Create) 1580 User may create everything (Create)
1581 User may edit everything (Edit) 1581 User may edit everything (Edit)
1582 User may use the email interface (Email Access)
1583 User may access the rest interface (Rest Access)
1582 User may restore everything (Restore) 1584 User may restore everything (Restore)
1583 User may retire everything (Retire) 1585 User may retire everything (Retire)
1584 User may view everything (View) 1586 User may view everything (View)
1585 User may access the web interface (Web Access) 1587 User may access the web interface (Web Access)
1586 User may access the rest interface (Rest Access) 1588 User may manipulate user Roles through the web (Web Roles)
1587 User may access the xmlrpc interface (Xmlrpc Access) 1589 User may access the xmlrpc interface (Xmlrpc Access)
1588 User may manipulate user Roles through the web (Web Roles)
1589 User may use the email interface (Email Access)
1590 Role "anonymous": 1590 Role "anonymous":
1591 User may access the web interface (Web Access) 1591 User may access the web interface (Web Access)
1592 User is allowed to register new user (Register for "user" only) 1592 User is allowed to access file (View for "file" only)
1593 User is allowed to access issue (View for "issue" only) 1593 User is allowed to access issue (View for "issue" only)
1594 User is allowed to access file (View for "file" only) 1594 User is allowed to access keyword (View for "keyword" only)
1595 User is allowed to access msg (View for "msg" only) 1595 User is allowed to access msg (View for "msg" only)
1596 User is allowed to access keyword (View for "keyword" only)
1597 User is allowed to access priority (View for "priority" only) 1596 User is allowed to access priority (View for "priority" only)
1598 User is allowed to access status (View for "status" only) 1597 User is allowed to access status (View for "status" only)
1598 User is allowed to register new user (Register for "user" only)
1599 (Search for "user" only) 1599 (Search for "user" only)
1600 Role "user": 1600 Role "user":
1601 User may access the web interface (Web Access)
1602 User may use the email interface (Email Access) 1601 User may use the email interface (Email Access)
1603 User may access the rest interface (Rest Access) 1602 User may access the rest interface (Rest Access)
1603 User may access the web interface (Web Access)
1604 User may access the xmlrpc interface (Xmlrpc Access) 1604 User may access the xmlrpc interface (Xmlrpc Access)
1605 User is allowed to create file (Create for "file" only)
1606 User is allowed to edit file (Edit for "file" only)
1607 User is allowed to access file (View for "file" only)
1608 User is allowed to create issue (Create for "issue" only)
1609 User is allowed to edit issue (Edit for "issue" only)
1605 User is allowed to access issue (View for "issue" only) 1610 User is allowed to access issue (View for "issue" only)
1606 User is allowed to edit issue (Edit for "issue" only) 1611 User is allowed to create keyword (Create for "keyword" only)
1607 User is allowed to create issue (Create for "issue" only) 1612 User is allowed to edit keyword (Edit for "keyword" only)
1608 User is allowed to access file (View for "file" only) 1613 User is allowed to access keyword (View for "keyword" only)
1609 User is allowed to edit file (Edit for "file" only) 1614 User is allowed to create msg (Create for "msg" only)
1610 User is allowed to create file (Create for "file" only) 1615 User is allowed to edit msg (Edit for "msg" only)
1611 User is allowed to access msg (View for "msg" only) 1616 User is allowed to access msg (View for "msg" only)
1612 User is allowed to edit msg (Edit for "msg" only)
1613 User is allowed to create msg (Create for "msg" only)
1614 User is allowed to access keyword (View for "keyword" only)
1615 User is allowed to edit keyword (Edit for "keyword" only)
1616 User is allowed to create keyword (Create for "keyword" only)
1617 User is allowed to access priority (View for "priority" only) 1617 User is allowed to access priority (View for "priority" only)
1618 User is allowed to create queries (Create for "query" only)
1619 User is allowed to edit their queries (Edit for "query" only)
1620 User is allowed to restore their queries (Restore for "query" only)
1621 User is allowed to retire their queries (Retire for "query" only)
1622 (Search for "query" only)
1623 User is allowed to view their own and public queries (View for "query" only)
1618 User is allowed to access status (View for "status" only) 1624 User is allowed to access status (View for "status" only)
1625 User is allowed to edit their own user details (Edit for "user": ('username', 'password', 'address', 'realname', 'phone', 'organisation', 'alternate_addresses', 'queries', 'timezone') only)
1619 (View for "user": ('id', 'organization', 'phone', 'realname', 'timezone', 'username') only) 1626 (View for "user": ('id', 'organization', 'phone', 'realname', 'timezone', 'username') only)
1620 1627
1621 **Invalid properties for user: ['organization'] 1628 **Invalid properties for user: ['organization']
1622 1629
1623 """ 1630 """

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