def list_identities(account): """ List all identities on an account_core. :param account: The account name. """ return account_core.list_identities(account)
def test_list_account_identities(self): """ ACCOUNT (CORE): Test listing of account identities """ email = 'email' identity = uuid() identity_type = IdentityType.USERPASS account = InternalAccount('root', **self.vo) add_account_identity(identity, identity_type, account, email, password='******') identities = list_identities(account) assert {'type': identity_type, 'identity': identity, 'email': email} in identities
def list_identities(account, vo='def'): """ List all identities on an account_core. :param account: The account name. :param vo: The VO to act on. """ account = InternalAccount(account, vo=vo) return account_core.list_identities(account)
def list_identities(account, vo='def', session=None): """ List all identities on an account_core. :param account: The account name. :param vo: The VO to act on. :param session: The database session in use. """ account = InternalAccount(account, vo=vo) return account_core.list_identities(account, session=session)
def add_vo(vo, description, email, session=None): """ Add a VO and setup a new root user. New root user will have account name 'root' and a userpass identity with username: '******' and password: '******' :param vo: 3-letter unique tag for a VO. :param descrition: Descriptive string for the VO (e.g. Full name). :param email: Contact email for the VO. :param session: The db session in use. """ if not config_get_bool( 'common', 'multi_vo', raise_exception=False, default=False): raise exception.UnsupportedOperation( 'VO operations cannot be performed in single VO mode.') if len(vo) != 3: raise exception.RucioException('Invalid VO tag, must be 3 chars.') new_vo = models.VO(vo=vo, description=description, email=email) try: new_vo.save(session=session) except IntegrityError: raise exception.Duplicate('VO {} already exists!'.format(vo)) except DatabaseError as error: raise exception.RucioException(error.args) from rucio.core.account import add_account, list_identities from rucio.core.identity import add_account_identity new_root = InternalAccount('root', vo=vo) add_account(account=new_root, type_=AccountType['SERVICE'], email=email, session=session) add_account_identity(identity='root@{}'.format(vo), type_=IdentityType['USERPASS'], account=new_root, email=email, default=False, password='******', session=session) for ident in list_identities(account=InternalAccount('super_root', vo='def'), session=session): add_account_identity(identity=ident['identity'], type_=ident['type'], account=new_root, email='', session=session)
def add_vo(vo, description, password, email, session=None): """ Add a VO and setup a new root user. New root user will have account name 'root' and a userpass identity with username: '******' and password from the rootpass parameter :param vo: 3-letter unique tag for a VO. :param descrition: Descriptive string for the VO (e.g. Full name). :param email: Contact email for the VO. :param password: The password to set for the root user of the new VO :param session: The db session in use. """ if len(vo) != 3: raise exception.RucioException('Invalid VO tag, must be 3 chars.') new_vo = models.VO(vo=vo, description=description, email=email) try: new_vo.save(session=session) except IntegrityError: raise exception.Duplicate('VO {} already exists!'.format(vo)) except DatabaseError as error: raise exception.RucioException(error.args) from rucio.core.account import add_account, list_identities from rucio.core.identity import add_account_identity new_root = InternalAccount('root', vo=vo) add_account(account=new_root, type=AccountType.from_sym('SERVICE'), email=email, session=session) add_account_identity(identity='root@{}'.format(vo), type=IdentityType.from_sym('userpass'), account=new_root, email=email, default=False, password=password, session=session) for ident in list_identities(account=InternalAccount('super_root', vo='def'), session=session): add_account_identity(identity=ident['identity'], type=ident['type'], account=new_root, email='', session=session)