mirror of https://github.com/jumpserver/jumpserver
				
				
				
			perf: web selector 默认值修改
							parent
							
								
									7b0d26bbff
								
							
						
					
					
						commit
						d60f9a7c69
					
				| 
						 | 
				
			
			@ -1,4 +1,5 @@
 | 
			
		|||
from django.db import models
 | 
			
		||||
 | 
			
		||||
from common.db.models import ChoicesMixin
 | 
			
		||||
 | 
			
		||||
__all__ = ['Protocol']
 | 
			
		||||
| 
						 | 
				
			
			@ -102,9 +103,9 @@ class Protocol(ChoicesMixin, models.TextChoices):
 | 
			
		|||
                'port': 80,
 | 
			
		||||
                'secret_types': ['password'],
 | 
			
		||||
                'setting': {
 | 
			
		||||
                    'username_selector': 'input[type=text]',
 | 
			
		||||
                    'password_selector': 'input[type=password]',
 | 
			
		||||
                    'submit_selector': 'button[type=submit]',
 | 
			
		||||
                    'username_selector': 'name=username',
 | 
			
		||||
                    'password_selector': 'name=password',
 | 
			
		||||
                    'submit_selector': 'id=longin_button',
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -112,7 +113,7 @@ class Protocol(ChoicesMixin, models.TextChoices):
 | 
			
		|||
    @classmethod
 | 
			
		||||
    def settings(cls):
 | 
			
		||||
        return {
 | 
			
		||||
             **cls.device_protocols(),
 | 
			
		||||
             **cls.database_protocols(),
 | 
			
		||||
             **cls.cloud_protocols()
 | 
			
		||||
            **cls.device_protocols(),
 | 
			
		||||
            **cls.database_protocols(),
 | 
			
		||||
            **cls.cloud_protocols()
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,3 @@
 | 
			
		|||
 | 
			
		||||
from assets.models import Web
 | 
			
		||||
from .common import AssetSerializer
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -19,12 +18,12 @@ class WebSerializer(AssetSerializer):
 | 
			
		|||
                'label': 'URL'
 | 
			
		||||
            },
 | 
			
		||||
            'username_selector': {
 | 
			
		||||
                'default': 'input[type=text]'
 | 
			
		||||
                'default': 'name=username'
 | 
			
		||||
            },
 | 
			
		||||
            'password_selector': {
 | 
			
		||||
                'default': 'input[type=password]'
 | 
			
		||||
                'default': 'name=password'
 | 
			
		||||
            },
 | 
			
		||||
            'submit_selector': {
 | 
			
		||||
                'default': 'button[type=submit]',
 | 
			
		||||
                'default': 'id=longin_button',
 | 
			
		||||
            },
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,24 +3,23 @@ from collections import defaultdict
 | 
			
		|||
 | 
			
		||||
from django.core.cache import cache
 | 
			
		||||
 | 
			
		||||
from users.models import User
 | 
			
		||||
from common.decorator import on_transaction_commit
 | 
			
		||||
from common.utils import get_logger
 | 
			
		||||
from common.utils.common import lazyproperty, timeit
 | 
			
		||||
from orgs.models import Organization
 | 
			
		||||
from orgs.utils import (
 | 
			
		||||
    tmp_to_org,
 | 
			
		||||
    tmp_to_root_org
 | 
			
		||||
)
 | 
			
		||||
from common.decorator import on_transaction_commit
 | 
			
		||||
from common.utils import get_logger
 | 
			
		||||
from common.utils.common import lazyproperty, timeit
 | 
			
		||||
 | 
			
		||||
from perms.locks import UserGrantedTreeRebuildLock
 | 
			
		||||
from perms.models import (
 | 
			
		||||
    AssetPermission,
 | 
			
		||||
    UserAssetGrantedTreeNodeRelation
 | 
			
		||||
)
 | 
			
		||||
from perms.utils.user_permission import UserGrantedTreeBuildUtils
 | 
			
		||||
from users.models import User
 | 
			
		||||
from .permission import AssetPermissionUtil
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
logger = get_logger(__name__)
 | 
			
		||||
 | 
			
		||||
__all__ = ['UserPermTreeRefreshUtil', 'UserPermTreeExpireUtil']
 | 
			
		||||
| 
						 | 
				
			
			@ -69,7 +68,7 @@ class UserPermTreeRefreshUtil(_UserPermTreeCacheMixin):
 | 
			
		|||
            end = time.time()
 | 
			
		||||
            logger.info(
 | 
			
		||||
                'Refresh user [{user}] org [{org}] perm tree, user {use_time:.2f}s'
 | 
			
		||||
                ''.format(user=self.user, org=org, use_time=end-start)
 | 
			
		||||
                ''.format(user=self.user, org=org, use_time=end - start)
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
    def clean_user_perm_tree_nodes_for_legacy_org(self):
 | 
			
		||||
| 
						 | 
				
			
			@ -142,4 +141,3 @@ class UserPermTreeExpireUtil(_UserPermTreeCacheMixin):
 | 
			
		|||
                p.delete(k)
 | 
			
		||||
            p.execute()
 | 
			
		||||
        logger.info('Expire all user perm tree')
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue