def add_s3_auth(access_key, secret_key, user_settings): if not has_access(access_key, secret_key): return False user_name, access_key = create_osf_user(access_key, secret_key, user_settings.owner.family_name) user_settings.s3_osf_user = user_name user_settings.access_key = access_key['access_key_id'] user_settings.secret_key = access_key['secret_access_key'] user_settings.save() return True
def add_s3_auth(access_key, secret_key, user_settings): if not has_access(access_key, secret_key): return False user_name, access_key = create_osf_user( access_key, secret_key, user_settings.owner.family_name ) user_settings.s3_osf_user = user_name user_settings.access_key = access_key['access_key_id'] user_settings.secret_key = access_key['secret_access_key'] user_settings.save() return True
def is_valid(self): return api.has_access(self.access_key, self.secret_key)